fastmcp.prompts.function_prompt
Standalone @prompt decorator for FastMCP.
Functions
prompt
Classes
DecoratedPrompt
Protocol for functions decorated with @prompt.
PromptMeta
Metadata attached to functions by the @prompt decorator.
FunctionPrompt
A prompt that is a function.
Methods:
from_function
fn: The function to wrapmetadata: PromptMeta object with all configuration. If provided, individual parameters must not be passed.name, title, etc.: Individual parameters for backwards compatibility. Cannot be used together with metadata parameter.
- str: wrapped as single user Message
- list[Message | str]: converted to list[Message]
- PromptResult: used directly
render
register_with_docket
add_to_docket
docket: The Docket instancearguments: Prompt argumentsfn_key: Function lookup key in Docket registry (defaults to self.key)task_key: Redis storage key for the result**kwargs: Additional kwargs passed to docket.add()

