PromptsAsTools transform bridges this gap by generating tools that provide access to your server’s prompts.
When you add PromptsAsTools to a server, it creates two tools that clients can call instead of using the prompt protocol:
list_promptsreturns JSON describing all available prompts and their argumentsget_promptrenders a specific prompt with provided arguments
Basic Usage
Pass your server toPromptsAsTools when adding the transform. The transform queries that server for prompts whenever the generated tools are called.
list_prompts and get_prompt.
Listing Prompts
Thelist_prompts tool returns JSON with metadata for each prompt, including its arguments.
name: The argument namedescription: Optional description from type hints or docstringsrequired: Whether the argument must be provided
Getting Prompts
Theget_prompt tool accepts a prompt name and optional arguments dict. It returns the rendered prompt as JSON with a messages array.
arguments field or pass an empty dict:
Message Format
Rendered prompts return a messages array following the standard MCP format. Each message includes:role: The message role (typically “user”, “assistant”, or “system”)content: The message text content