prompt
fastmcp.prompts.prompt
Base classes for FastMCP prompts.
Functions
Message
A user-friendly constructor for PromptMessage.
Classes
PromptArgument
An argument that can be passed to a prompt.
Prompt
A prompt template that can be rendered with parameters.
Methods:
to_mcp_prompt
Convert the prompt to an MCP prompt.
from_function
Create a Prompt from a function.
The function can return:
- A string (converted to a message)
- A Message object
- A dict (converted to a message)
- A sequence of any of the above
FunctionPrompt
A prompt that is a function.
Methods:
from_function
Create a Prompt from a function.
The function can return:
- A string (converted to a message)
- A Message object
- A dict (converted to a message)
- A sequence of any of the above