π The fast, Pythonic way to build MCP servers and clients.
Fix decorator overload return types for function mode (#3258)
Jeremiah Lowinbb3e159bc643
diff --git a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-prompts.mdx b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-prompts.mdxindex d070aacb7..e7d7d68f9 100644--- a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-prompts.mdx+++ b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-prompts.mdx@@ -14,7 +14,7 @@ registration functionality to LocalProvider.## Classes-### `PromptDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `PromptDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Mixin class providing prompt decorator functionality for LocalProvider.@@ -26,7 +26,7 @@ This mixin contains all methods related to:**Methods:**-#### `add_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L35" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_prompt(self: LocalProvider, prompt: Prompt | Callable[..., Any]) -> Prompt@@ -37,19 +37,19 @@ Add a prompt to this provider's storage.Accepts either a Prompt object or a decorated function with __fastmcp__ metadata.-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-prompt(self: LocalProvider, name_or_fn: AnyFunction) -> FunctionPrompt+prompt(self: LocalProvider, name_or_fn: F) -> F```-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L89" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-prompt(self: LocalProvider, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionPrompt]+prompt(self: LocalProvider, name_or_fn: str | None = None) -> Callable[[F], F]```-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/prompts.py#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprompt(self: LocalProvider, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt | partial[Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt]diff --git a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-resources.mdx b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-resources.mdxindex fe1727e3c..70c67d91c 100644--- a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-resources.mdx+++ b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-resources.mdx@@ -14,7 +14,7 @@ and template registration functionality to LocalProvider.## Classes-### `ResourceDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `ResourceDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Mixin class providing resource decorator functionality for LocalProvider.@@ -27,7 +27,7 @@ This mixin contains all methods related to:**Methods:**-#### `add_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L36" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource(self: LocalProvider, resource: Resource | ResourceTemplate | Callable[..., Any]) -> Resource | ResourceTemplate@@ -38,7 +38,7 @@ Add a resource to this provider's storage.Accepts either a Resource/ResourceTemplate object or a decorated function with __fastmcp__ metadata.-#### `add_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_template(self: LocalProvider, template: ResourceTemplate) -> ResourceTemplate@@ -47,10 +47,10 @@ add_template(self: LocalProvider, template: ResourceTemplate) -> ResourceTemplatAdd a resource template to this provider's storage.-#### `resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/resources.py#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-resource(self: LocalProvider, uri: str) -> Callable[[AnyFunction], Resource | ResourceTemplate | AnyFunction]+resource(self: LocalProvider, uri: str) -> Callable[[F], F]```Decorator to register a function as a resource.diff --git a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-tools.mdx b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-tools.mdxindex 07c6219fa..d3cf4daa2 100644--- a/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-tools.mdx+++ b/docs/python-sdk/fastmcp-server-providers-local_provider-decorators-tools.mdx@@ -14,7 +14,7 @@ registration functionality to LocalProvider.## Classes-### `ToolDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L32" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `ToolDecoratorMixin` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L34" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Mixin class providing tool decorator functionality for LocalProvider.@@ -26,7 +26,7 @@ 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#L40" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_tool(self: LocalProvider, tool: Tool | Callable[..., Any]) -> Tool@@ -37,19 +37,19 @@ 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#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L93" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-tool(self: LocalProvider, name_or_fn: AnyFunction) -> FunctionTool+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#L113" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L115" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-tool(self: LocalProvider, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionTool]+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#L138" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/providers/local_provider/decorators/tools.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontool(self: LocalProvider, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool | partial[Callable[[AnyFunction], FunctionTool] | FunctionTool]diff --git a/docs/python-sdk/fastmcp-server-server.mdx b/docs/python-sdk/fastmcp-server-server.mdxindex be0129414..267f66d13 100644--- a/docs/python-sdk/fastmcp-server-server.mdx+++ b/docs/python-sdk/fastmcp-server-server.mdx@@ -10,7 +10,7 @@ FastMCP - A more ergonomic interface for MCP servers.## Functions-### `default_lifespan` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L168" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `default_lifespan` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L169" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondefault_lifespan(server: FastMCP[LifespanResultT]) -> AsyncIterator[Any]@@ -26,7 +26,7 @@ Default lifespan context manager that does nothing.- An empty dictionary as the lifespan result.-### `create_proxy` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2081" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `create_proxy` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2079" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_proxy(target: Client[ClientTransportT] | ClientTransport | FastMCP[Any] | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | str, **settings: Any) -> FastMCPProxy@@ -54,53 +54,53 @@ use `FastMCPProxy` or `ProxyProvider` directly from `fastmcp.server.providers.pr## Classes-### `StateValue` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L204" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `StateValue` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L205" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Wrapper for stored context state values.-### `FastMCP` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L210" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `FastMCP` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L211" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `name` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L347" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `name` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L348" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonname(self) -> str```-#### `instructions` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L351" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `instructions` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L352" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninstructions(self) -> str | None```-#### `instructions` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L355" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `instructions` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L356" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninstructions(self, value: str | None) -> None```-#### `version` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L359" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `version` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L360" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonversion(self) -> str | None```-#### `website_url` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L363" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `website_url` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L364" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonwebsite_url(self) -> str | None```-#### `icons` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L367" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `icons` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L368" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonicons(self) -> list[mcp.types.Icon]```-#### `local_provider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L374" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `local_provider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L375" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlocal_provider(self) -> LocalProvider@@ -115,13 +115,13 @@ Use this to remove components:mcp.local_provider.remove_prompt("my_prompt")-#### `add_middleware` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L396" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_middleware` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L397" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_middleware(self, middleware: Middleware) -> None```-#### `add_provider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L399" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_provider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L400" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_provider(self, provider: Provider) -> None@@ -141,7 +141,7 @@ always take precedence over providers.- Prompts become "namespace_promptname"-#### `get_tasks` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L421" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_tasks` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L422" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_tasks(self) -> Sequence[FastMCPComponent]@@ -153,7 +153,7 @@ Overrides AggregateProvider.get_tasks() to apply server-level transformsafter aggregation. AggregateProvider handles provider-level namespacing.-#### `add_transform` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L450" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_transform` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L451" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_transform(self, transform: Transform) -> None@@ -168,7 +168,7 @@ They transform tools, resources, and prompts from ALL providers.- `transform`: The transform to add.-#### `add_tool_transformation` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L470" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_tool_transformation` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L471" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_tool_transformation(self, tool_name: str, transformation: ToolTransformConfig) -> None@@ -180,7 +180,7 @@ Add a tool transformation.Use ``add_transform(ToolTransform({...}))`` instead.-#### `remove_tool_transformation` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L487" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `remove_tool_transformation` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L488" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonremove_tool_transformation(self, _tool_name: str) -> None@@ -192,7 +192,7 @@ Remove a tool transformation.Tool transformations are now immutable. Use enable/disable controls instead.-#### `list_tools` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L502" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `list_tools` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L503" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_tools(self) -> Sequence[Tool]@@ -205,7 +205,7 @@ and middleware execution. Returns all versions (no deduplication).Protocol handlers deduplicate for MCP wire format.-#### `get_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L572" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L573" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_tool(self, name: str, version: VersionSpec | None = None) -> Tool | None@@ -225,7 +225,7 @@ session transforms can override provider-level disables.- The tool if found and enabled, None otherwise.-#### `list_resources` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L598" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `list_resources` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L599" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_resources(self) -> Sequence[Resource]@@ -238,7 +238,7 @@ and middleware execution. Returns all versions (no deduplication).Protocol handlers deduplicate for MCP wire format.-#### `get_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L670" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L671" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_resource(self, uri: str, version: VersionSpec | None = None) -> Resource | None@@ -257,7 +257,7 @@ transforms (including session-level) have been applied.- The resource if found and enabled, None otherwise.-#### `list_resource_templates` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L695" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `list_resource_templates` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L696" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_resource_templates(self) -> Sequence[ResourceTemplate]@@ -270,7 +270,7 @@ auth filtering, and middleware execution. Returns all versions (no deduplicationProtocol handlers deduplicate for MCP wire format.-#### `get_resource_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L769" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_resource_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L770" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_resource_template(self, uri: str, version: VersionSpec | None = None) -> ResourceTemplate | None@@ -289,7 +289,7 @@ all transforms (including session-level) have been applied.- The template if found and enabled, None otherwise.-#### `list_prompts` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L794" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `list_prompts` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L795" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_prompts(self) -> Sequence[Prompt]@@ -302,7 +302,7 @@ and middleware execution. Returns all versions (no deduplication).Protocol handlers deduplicate for MCP wire format.-#### `get_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L864" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L865" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_prompt(self, name: str, version: VersionSpec | None = None) -> Prompt | None@@ -321,19 +321,19 @@ transforms (including session-level) have been applied.- The prompt if found and enabled, None otherwise.-#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L890" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L891" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncall_tool(self, name: str, arguments: dict[str, Any] | None = None) -> ToolResult```-#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L901" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L902" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncall_tool(self, name: str, arguments: dict[str, Any] | None = None) -> mcp.types.CreateTaskResult```-#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L911" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `call_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L912" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncall_tool(self, name: str, arguments: dict[str, Any] | None = None) -> ToolResult | mcp.types.CreateTaskResult@@ -363,19 +363,19 @@ return ToolResult.- `ValidationError`: If arguments fail validation-#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1007" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1008" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonread_resource(self, uri: str) -> ResourceResult```-#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1017" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1018" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonread_resource(self, uri: str) -> mcp.types.CreateTaskResult```-#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1026" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `read_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1027" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonread_resource(self, uri: str) -> ResourceResult | mcp.types.CreateTaskResult@@ -404,19 +404,19 @@ return ResourceResult.- `ResourceError`: If resource read fails-#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1160" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1161" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrender_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> PromptResult```-#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1171" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1172" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrender_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> mcp.types.CreateTaskResult```-#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1181" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `render_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrender_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> PromptResult | mcp.types.CreateTaskResult@@ -446,7 +446,7 @@ return PromptResult.- `PromptError`: If prompt rendering fails-#### `add_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1257" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1258" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_tool(self, tool: Tool | Callable[..., Any]) -> Tool@@ -464,7 +464,7 @@ with the Context type annotation. See the @tool decorator for examples.- The tool instance that was added to the server.-#### `remove_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1271" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `remove_tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1272" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonremove_tool(self, name: str, version: str | None = None) -> None@@ -483,19 +483,19 @@ Remove tool(s) from the server.- `NotFoundError`: If no matching tool is found.-#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1301" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1302" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-tool(self, name_or_fn: AnyFunction) -> FunctionTool+tool(self, name_or_fn: F) -> F```-#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1322" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1323" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-tool(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionTool]+tool(self, name_or_fn: str | None = None) -> Callable[[F], F]```-#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1342" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `tool` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1343" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontool(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool | partial[Callable[[AnyFunction], FunctionTool] | FunctionTool]@@ -551,7 +551,7 @@ server.tool(my_function, name="custom_name")```-#### `add_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1441" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1442" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource(self, resource: Resource | Callable[..., Any]) -> Resource | ResourceTemplate@@ -566,7 +566,7 @@ Add a resource to the server.- The resource instance that was added to the server.-#### `add_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1454" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_template` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1455" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_template(self, template: ResourceTemplate) -> ResourceTemplate@@ -581,10 +581,10 @@ Add a resource template to the server.- The template instance that was added to the server.-#### `resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1465" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `resource` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1466" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-resource(self, uri: str) -> Callable[[AnyFunction], Resource | ResourceTemplate | AnyFunction]+resource(self, uri: str) -> Callable[[F], F]```Decorator to register a function as a resource.@@ -640,7 +640,7 @@ async def get_weather(city: str) -> str:```-#### `add_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1587" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `add_prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1585" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_prompt(self, prompt: Prompt | Callable[..., Any]) -> Prompt@@ -655,19 +655,19 @@ Add a prompt to the server.- The prompt instance that was added to the server.-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1599" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1597" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-prompt(self, name_or_fn: AnyFunction) -> FunctionPrompt+prompt(self, name_or_fn: F) -> F```-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1615" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1613" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-prompt(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionPrompt]+prompt(self, name_or_fn: str | None = None) -> Callable[[F], F]```-#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1630" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prompt` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1628" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprompt(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt | partial[Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt]@@ -744,7 +744,7 @@ Decorator to register a prompt.```-#### `mount` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1730" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `mount` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1728" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmount(self, server: FastMCP[LifespanResultT], namespace: str | None = None, as_proxy: bool | None = None, tool_names: dict[str, str] | None = None, prefix: str | None = None) -> None@@ -791,7 +791,7 @@ mounted server.- `prefix`: Deprecated. Use namespace instead.-#### `import_server` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1824" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `import_server` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1822" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonimport_server(self, server: FastMCP[LifespanResultT], prefix: str | None = None) -> None@@ -832,7 +832,7 @@ templates, and prompts are imported with their original names.objects are imported with their original names.-#### `from_openapi` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1924" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `from_openapi` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1922" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient | None = None, name: str = 'OpenAPI Server', route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, tags: set[str] | None = None, validate_output: bool = True, **settings: Any) -> Self@@ -861,7 +861,7 @@ response structure while still returning structured JSON.- A FastMCP server with an OpenAPIProvider attached.-#### `from_fastapi` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1975" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `from_fastapi` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L1973" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, httpx_client_kwargs: dict[str, Any] | None = None, tags: set[str] | None = None, **settings: Any) -> Self@@ -885,7 +885,7 @@ Use this to configure timeout and other client settings.- A FastMCP server with an OpenAPIProvider attached.-#### `as_proxy` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2030" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `as_proxy` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2028" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonas_proxy(cls, backend: Client[ClientTransportT] | ClientTransport | FastMCP[Any] | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | str, **settings: Any) -> FastMCPProxy@@ -903,7 +903,7 @@ instance or any value accepted as the `transport` argument of`fastmcp.client.Client` constructor.-#### `generate_name` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2067" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `generate_name` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/server.py#L2065" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythongenerate_name(cls, name: str | None = None) -> strdiff --git a/src/fastmcp/server/providers/local_provider/decorators/prompts.py b/src/fastmcp/server/providers/local_provider/decorators/prompts.pyindex 5e01b7a04..d36c7d2f4 100644--- a/src/fastmcp/server/providers/local_provider/decorators/prompts.py+++ b/src/fastmcp/server/providers/local_provider/decorators/prompts.py@@ -9,7 +9,7 @@ from __future__ import annotationsimport inspectfrom collections.abc import Callablefrom functools import partial-from typing import TYPE_CHECKING, Any, overload+from typing import TYPE_CHECKING, Any, TypeVar, overloadimport mcp.typesfrom mcp.types import AnyFunction@@ -23,6 +23,8 @@ from fastmcp.server.tasks.config import TaskConfigif TYPE_CHECKING:from fastmcp.server.providers.local_provider import LocalProvider+F = TypeVar("F", bound=Callable[..., Any])+class PromptDecoratorMixin:"""Mixin class providing prompt decorator functionality for LocalProvider.@@ -71,7 +73,7 @@ class PromptDecoratorMixin:@overloaddef prompt(self: LocalProvider,- name_or_fn: AnyFunction,+ name_or_fn: F,*,name: str | None = None,version: str | int | None = None,@@ -83,7 +85,7 @@ class PromptDecoratorMixin:meta: dict[str, Any] | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> FunctionPrompt: ...+ ) -> F: ...@overloaddef prompt(@@ -100,7 +102,7 @@ class PromptDecoratorMixin:meta: dict[str, Any] | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], FunctionPrompt]: ...+ ) -> Callable[[F], F]: ...def prompt(self: LocalProvider,diff --git a/src/fastmcp/server/providers/local_provider/decorators/resources.py b/src/fastmcp/server/providers/local_provider/decorators/resources.pyindex 52314378e..80a3e9a5c 100644--- a/src/fastmcp/server/providers/local_provider/decorators/resources.py+++ b/src/fastmcp/server/providers/local_provider/decorators/resources.py@@ -8,7 +8,7 @@ from __future__ import annotationsimport inspectfrom collections.abc import Callable-from typing import TYPE_CHECKING, Any+from typing import TYPE_CHECKING, Any, TypeVarimport mcp.typesfrom mcp.types import Annotations, AnyFunction@@ -23,6 +23,8 @@ from fastmcp.server.tasks.config import TaskConfigif TYPE_CHECKING:from fastmcp.server.providers.local_provider import LocalProvider+F = TypeVar("F", bound=Callable[..., Any])+class ResourceDecoratorMixin:"""Mixin class providing resource decorator functionality for LocalProvider.@@ -118,7 +120,7 @@ class ResourceDecoratorMixin:meta: dict[str, Any] | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], Resource | ResourceTemplate | AnyFunction]:+ ) -> Callable[[F], F]:"""Decorator to register a function as a resource.If the URI contains parameters (e.g. "resource://{param}") or the function@@ -166,7 +168,7 @@ class ResourceDecoratorMixin:resolved_task: bool | TaskConfig = task if task is not None else False- def decorator(fn: AnyFunction) -> Resource | ResourceTemplate | AnyFunction:+ def decorator(fn: AnyFunction) -> Any:# Check for unbound methodtry:params = list(inspect.signature(fn).parameters.keys())diff --git a/src/fastmcp/server/providers/local_provider/decorators/tools.py b/src/fastmcp/server/providers/local_provider/decorators/tools.pyindex c59fa8a3f..93209eb21 100644--- a/src/fastmcp/server/providers/local_provider/decorators/tools.py+++ b/src/fastmcp/server/providers/local_provider/decorators/tools.py@@ -10,7 +10,7 @@ import inspectimport warningsfrom collections.abc import Callablefrom functools import partial-from typing import TYPE_CHECKING, Any, Literal, overload+from typing import TYPE_CHECKING, Any, Literal, TypeVar, overloadimport mcp.typesfrom mcp.types import AnyFunction, ToolAnnotations@@ -26,6 +26,8 @@ if TYPE_CHECKING:from fastmcp.server.providers.local_provider import LocalProviderfrom fastmcp.tools.tool import ToolResultSerializerType+F = TypeVar("F", bound=Callable[..., Any])+DuplicateBehavior = Literal["error", "warn", "replace", "ignore"]@@ -90,7 +92,7 @@ class ToolDecoratorMixin:@overloaddef tool(self: LocalProvider,- name_or_fn: AnyFunction,+ name_or_fn: F,*,name: str | None = None,version: str | int | None = None,@@ -107,7 +109,7 @@ class ToolDecoratorMixin:serializer: ToolResultSerializerType | None = None, # Deprecatedtimeout: float | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> FunctionTool: ...+ ) -> F: ...@overloaddef tool(@@ -129,7 +131,7 @@ class ToolDecoratorMixin:serializer: ToolResultSerializerType | None = None, # Deprecatedtimeout: float | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], FunctionTool]: ...+ ) -> Callable[[F], F]: ...# NOTE: This method mirrors fastmcp.tools.tool() but adds registration,# the `enabled` param, and supports deprecated params (serializer, exclude_args).diff --git a/src/fastmcp/server/server.py b/src/fastmcp/server/server.pyindex 1900ee148..db558dca3 100644--- a/src/fastmcp/server/server.py+++ b/src/fastmcp/server/server.py@@ -19,7 +19,7 @@ from contextlib import (from dataclasses import replacefrom functools import partialfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Generic, Literal, cast, overload+from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, cast, overloadimport httpximport mcp.types@@ -99,6 +99,7 @@ if TYPE_CHECKING:logger = get_logger(__name__)+F = TypeVar("F", bound=Callable[..., Any])DuplicateBehavior = Literal["warn", "error", "replace", "ignore"]@@ -1300,7 +1301,7 @@ class FastMCP(@overloaddef tool(self,- name_or_fn: AnyFunction,+ name_or_fn: F,*,name: str | None = None,version: str | int | None = None,@@ -1316,7 +1317,7 @@ class FastMCP(task: bool | TaskConfig | None = None,timeout: float | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> FunctionTool: ...+ ) -> F: ...@overloaddef tool(@@ -1337,7 +1338,7 @@ class FastMCP(task: bool | TaskConfig | None = None,timeout: float | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], FunctionTool]: ...+ ) -> Callable[[F], F]: ...def tool(self,@@ -1478,7 +1479,7 @@ class FastMCP(app: AppConfig | dict[str, Any] | bool | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], Resource | ResourceTemplate | AnyFunction]:+ ) -> Callable[[F], F]:"""Decorator to register a function as a resource.The function will be called when the resource is read to generate its content.@@ -1579,10 +1580,7 @@ class FastMCP(auth=auth,)- def decorator(fn: AnyFunction) -> Resource | ResourceTemplate | AnyFunction:- return inner_decorator(fn)-- return decorator+ return inner_decoratordef add_prompt(self, prompt: Prompt | Callable[..., Any]) -> Prompt:"""Add a prompt to the server.@@ -1598,7 +1596,7 @@ class FastMCP(@overloaddef prompt(self,- name_or_fn: AnyFunction,+ name_or_fn: F,*,name: str | None = None,version: str | int | None = None,@@ -1609,7 +1607,7 @@ class FastMCP(meta: dict[str, Any] | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> FunctionPrompt: ...+ ) -> F: ...@overloaddef prompt(@@ -1625,7 +1623,7 @@ class FastMCP(meta: dict[str, Any] | None = None,task: bool | TaskConfig | None = None,auth: AuthCheck | list[AuthCheck] | None = None,- ) -> Callable[[AnyFunction], FunctionPrompt]: ...+ ) -> Callable[[F], F]: ...def prompt(self,