Skip to content

How to use prompts and resources in MCP servers? Can prompts and resources be reused or called from tools? #481

Closed

Description

@pedrojfds

I'm building an MCP server using @modelcontextprotocol/sdk with TypeScript and integrating it into an app like VSCode. From what I see, only tools are recognized and used by the app/client, while resources like prompt are not.

I'm trying to understand:

How are prompt resources meant to be used in an MCP server?

Can a prompt be invoked from within a tool? (e.g., a tool that internally calls a prompt and returns its result)

What's the recommended pattern for reusing prompts across tools or other resources?

In environments like VSCode, is there any support for exposing non-tool resources (like prompts or resources) or linking prompts and tools in some way?

Some documentation or example code would be really helpful to clarify how prompts and other resources should be structured and composed with tools.

Thanks a lot!

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    on May 12, 2025
  2. changed the title [-]How to use prompt and other resource types in MCP servers? Can prompts be reused or called from tools?[/-] [+]How to use prompts and resources in MCP servers? Can prompts and resources be reused or called from tools?[/+] on May 12, 2025
  3. KingfinnX commented on May 17, 2025

    @KingfinnX

    same question

  4. hasani114 commented on Jun 13, 2025

    @hasani114

    Vscode now supports both prompts and resources in agent mode. To access prompts exposed by a server you can use the "/" for quickly accessing the prompts. Clicking on "Add Context" button will allow you to select a Resource and insert it into the context window of the Agent.

    Would be interested in knowing whether a tool can access the servers prompts and resources. I don't think it should be an issue since primitives like the root were created to be consumed by the server itself.

  5. RobbyRabbitman commented on Jul 11, 2025

    @RobbyRabbitman

    Vscode now supports both prompts and resources in agent mode. To access prompts exposed by a server you can use the "/" for quickly accessing the prompts. Clicking on "Add Context" button will allow you to select a Resource and insert it into the context window of the Agent.

    Would be interested in knowing whether a tool can access the servers prompts and resources. I don't think it should be an issue since primitives like the root were created to be consumed by the server itself.

    omg your statement makes sense for me now!!! I was thinking what the f is the difference between a resource and a tool and why vs code co pilot seem not to use resources. For me, implementing resources made more sense since my mcp server should expose documentation information, but only exposed as tools they were used by copilot, which is weird because you can really nicely declare resources with the sdk. Also apparently according to the sdk a tool can return an array of resource links, but those were never used. In generel I found, that only the first object of that array was used, regardless of the object type. Idk really, this stuff seems really powerful but really buggy and undocumented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature that's not currently supported

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions