fastmcp.server.providers.local_provider.decorators.tools
Tool decorator mixin for LocalProvider.
This module provides the ToolDecoratorMixin class that adds tool
registration functionality to LocalProvider.
Classes
ToolDecoratorMixin
Mixin class providing tool decorator functionality for LocalProvider.
This mixin contains all methods related to:
- Tool registration via add_tool()
- Tool decorator (@provider.tool)
add_tool
tool
tool
tool
- @provider.tool (without parentheses)
- @provider.tool() (with empty parentheses)
- @provider.tool(“custom_name”) (with name as first argument)
- @provider.tool(name=“custom_name”) (with name as keyword argument)
- provider.tool(function, name=“custom_name”) (direct function call)
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 behaviorexclude_args: Optional list of argument names to exclude from the tool schemameta: Optional meta information about the toolenabled: Whether the tool is enabled (default True). If False, adds to blocklist.task: Optional task configuration for background executionserializer: Deprecated. Return ToolResult from your tools for full control over serialization.
- The registered FunctionTool or a decorator function.

