Skip to main content

fastmcp.server.transforms.resources_as_tools

Transform that exposes resources as tools. This transform generates tools for listing and reading resources, enabling clients that only support tools to access resource functionality. Example:

Classes

ResourcesAsTools

Transform that adds tools for listing and reading resources. Generates two tools:
  • list_resources: Lists all resources and templates from the provider
  • read_resource: Reads a resource by URI
The transform captures a provider reference at construction and queries it for resources when the generated tools are called. When used with FastMCP, the provider’s auth and visibility filtering is automatically applied. Methods:

list_tools

Add resource tools to the tool list.

get_tool

Get a tool by name, including generated resource tools.