fastmcp.tools.tool
Functions
default_serializer
tool
- Creating tools that will be transformed before registration
- Defining tools in modules that are discovered by FileSystemProvider
- Creating reusable tool definitions
- @tool (without parentheses)
- @tool() (with empty parentheses)
- @tool(“custom_name”) (with name as first argument)
- @tool(name=“custom_name”) (with name as keyword argument)
name_or_fn: Either a function (when used as @tool), a string name, or Nonename: Optional name for the tool (keyword-only, alternative to name_or_fn)title: Optional title for the tooldescription: Optional description of what the tool doesicons: Optional icons for the tooltags: Optional set of tags for categorizing the tooloutput_schema: Optional JSON schema for the tool’s outputannotations: Optional annotations about the tool’s behaviormeta: Optional meta information about the tooltask: Optional task configuration for background execution (default False)
- A FunctionTool when decorating a function, or a decorator function when
- called with parameters.
Classes
ToolResult
Methods:
to_mcp_result
Tool
Internal tool registration info.
Methods:
to_mcp_tool
from_function
run
run() can EITHER return a list of ContentBlocks, or a tuple of
(list of ContentBlocks, dict of structured output).
convert_result
register_with_docket
add_to_docket
docket: The Docket instancearguments: Tool 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()
from_tool
FunctionTool
Methods:
to_mcp_tool
from_function
run
register_with_docket
add_to_docket
docket: The Docket instancearguments: Tool 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()

