Use server-side prompt templates with automatic argument serialization.
New in version: 2.0.0
Prompts are reusable message templates exposed by MCP servers. They can accept arguments to generate personalized message sequences for LLM interactions.
list_prompts()
to retrieve all available prompt templates:
New in version: 2.11.0
You can use the meta
field to filter prompts based on their tags:
_meta
field is part of the standard MCP specification. FastMCP servers include tags and other metadata within a _fastmcp
namespace (e.g., _meta._fastmcp.tags
) to avoid conflicts with user-defined metadata. This behavior can be controlled with the server’s include_fastmcp_meta
setting - when disabled, the _fastmcp
namespace won’t be included. Other MCP server implementations may not provide this metadata structure.get_prompt()
with the prompt name and arguments:
New in version: 2.9.0
FastMCP automatically serializes complex arguments to JSON strings as required by the MCP specification. This allows you to pass typed objects directly:
pydantic_core.to_json()
for consistent formatting. FastMCP servers can automatically deserialize these JSON strings back to the expected types.
get_prompt()
method returns a GetPromptResult
object containing a list of messages:
*_mcp
methods:
list_prompts()
to see available arguments for each prompt.