docs/python-sdk/fastmcp-server-providers-local_provider-decorators-tools.mdx
fastmcp.server.providers.local_provider.decorators.toolsTool decorator mixin for LocalProvider.
This module provides the ToolDecoratorMixin class that adds tool registration functionality to LocalProvider.
ToolDecoratorMixin <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L118" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Mixin class providing tool decorator functionality for LocalProvider.
This mixin contains all methods related to:
Methods:
add_tool <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L126" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>add_tool(self: LocalProvider, tool: Tool | Callable[..., Any]) -> Tool
Add a tool to this provider's storage.
Accepts either a Tool object or a decorated function with fastmcp metadata.
tool <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L178" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>tool(self: LocalProvider, name_or_fn: F) -> F
tool <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L200" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>tool(self: LocalProvider, name_or_fn: str | None = None) -> Callable[[F], F]
tool <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L225" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>tool(self: LocalProvider, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool | partial[Callable[[AnyFunction], FunctionTool] | FunctionTool]
Decorator to register a tool.
This decorator supports multiple calling patterns:
Args:
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.Returns: