docs/python-sdk/fastmcp-server-providers-local_provider-decorators-resources.mdx
fastmcp.server.providers.local_provider.decorators.resourcesResource decorator mixin for LocalProvider.
This module provides the ResourceDecoratorMixin class that adds resource and template registration functionality to LocalProvider.
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.
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#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>add_resource(self: LocalProvider, resource: Resource | ResourceTemplate | Callable[..., Any]) -> Resource | ResourceTemplate
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#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>add_template(self: LocalProvider, template: ResourceTemplate) -> ResourceTemplate
Add 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#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>resource(self: LocalProvider, uri: str) -> Callable[[F], F]
Decorator to register a function as a resource.
If the URI contains parameters (e.g. "resource://{param}") or the function has parameters, it will be registered as a template resource.
Args:
uri: URI for the resource (e.g. "resource://my-resource" or "resource://{param}")name: Optional name for the resourcetitle: Optional title for the resourcedescription: Optional description of the resourceicons: Optional icons for the resourcemime_type: Optional MIME type for the resourcetags: Optional set of tags for categorizing the resourceenabled: Whether the resource is enabled (default True). If False, adds to blocklist.annotations: Optional annotations about the resource's behaviormeta: Optional meta information about the resourcetask: Optional task configuration for background executionauth: Optional authorization checks for the resourceReturns: