Skip to content

[FEATURE]: Convert prompts and resources to tools in virtual servers #2074

@crivetimihai

Description

@crivetimihai

Summary

Add the ability to expose MCP prompts and resources as callable tools within virtual servers. This would allow clients that only support tool-based interactions to leverage the full MCP specification through a unified tool interface.

Motivation

  • Some MCP clients only support tool calls and don't natively handle prompts or resources
  • Exposing prompts/resources as tools provides a consistent interaction model
  • Enables broader compatibility across different client implementations
  • Simplifies integration for clients with limited MCP support

Proposed Behavior

Prompts as Tools

  • Each registered prompt becomes a tool with:
    • Tool name derived from prompt name (e.g., prompt_<name> or configurable prefix)
    • Tool arguments matching the prompt's input schema
    • Tool response containing the rendered prompt output

Resources as Tools

  • Each registered resource becomes a tool with:
    • Tool name derived from resource URI or name
    • Tool for reading/fetching the resource content
    • Optional tools for resource operations (if supported)

Configuration Options

Consider adding virtual server configuration options:

  • expose_prompts_as_tools: boolean (default: false)
  • expose_resources_as_tools: boolean (default: false)
  • tool_name_prefix: customizable prefix for generated tools
  • resource_tool_operations: list of operations to expose (read, list, etc.)

Implementation Considerations

  • Handle naming collisions between native tools and converted prompts/resources
  • Preserve metadata and descriptions in tool schemas
  • Consider caching strategies for resource-based tools
  • Document the mapping conventions for users

Related

  • MCP Specification: Prompts, Resources, and Tools
  • Virtual server composition logic in mcpgateway/services/

Metadata

Metadata

Assignees

Labels

COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsenhancementNew feature or requestpythonPython / backend development (FastAPI)
No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions