fastmcp/docs
William Easton f5dbabff4e
Add ToolInjectionMiddleware + Tools for Read/List Resource/Prompt for Client Compat (#2142)
* Add compatibility tools contrib module

Implements four standalone tools that expose resources and prompts
as callable tools for clients that only support the tools capability.

Features:
- list_resources: List all available resources
- get_resource: Read a resource by URI
- list_prompts: List all available prompts
- get_prompt: Get a prompt with optional arguments

The tools use Context to access the server instance and can be easily
added to any FastMCP server using the add_compatibility_tools helper
or by adding individual tool instances directly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: William Easton <strawgate@users.noreply.github.com>

* Simplify compatibility tools to return raw MCP protocol objects

Return raw MCP protocol objects (ListResourcesResult, ReadResourceResult,
ListPromptsResult, GetPromptResult) instead of custom dictionaries. This
makes the tools simpler and more predictable by directly exposing what
the client methods return.

Co-authored-by: William Easton <strawgate@users.noreply.github.com>

* Add tool injection middleware

* cleanup contrib module

* More clean-up

* Clean up tool injection middleware.

* Update src/fastmcp/server/middleware/tool_injection.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add tool injection docs

* Small cleanup of prompt middleware

* PR Feedback

* Fix tool injection tests

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: William Easton <strawgate@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-24 18:06:58 -04:00
..
.cursor/rules Clean up parameter documentation 2025-06-22 20:59:53 -04:00
assets Support custom server name, icons, and link in OAuth Proxy consent page (#2135) 2025-10-18 11:49:26 -04:00
clients Move sampling fallback handler docs to server section (#2163) 2025-10-21 10:02:11 -04:00
community Update docs (#2094) 2025-10-14 16:38:21 -07:00
css Update wordmark (#1832) 2025-09-15 18:14:37 -04:00
deployment Add platform-aware OAuth token persistence (#2218) 2025-10-22 20:42:24 -04:00
development Add platform-aware OAuth token persistence (#2218) 2025-10-22 20:42:24 -04:00
getting-started Docs (#2145) 2025-10-19 20:26:08 -04:00
integrations Expose OAuth token management parameters in all providers (#2222) 2025-10-22 21:51:37 -04:00
patterns Fix missing import in Tool Transformation docs. (#2108) 2025-10-15 17:49:19 -07:00
public/schemas/fastmcp.json chore: Update fastmcp.json schema (#1955) 2025-09-29 20:12:24 -04:00
python-sdk chore: Update SDK documentation (#2171) 2025-10-21 11:32:32 -04:00
servers Add ToolInjectionMiddleware + Tools for Read/List Resource/Prompt for Client Compat (#2142) 2025-10-24 18:06:58 -04:00
snippets Add MCP json output from CLI (#1056) 2025-07-06 10:23:50 -04:00
tutorials Add comprehensive OAuth 2.1 authentication system with WorkOS integration (#1327) 2025-08-01 17:06:55 -04:00
.ccignore Add comprehensive OAuth 2.1 authentication system with WorkOS integration (#1327) 2025-08-01 17:06:55 -04:00
changelog.mdx Update changelog for 2.12.5 (#2146) 2025-10-19 20:33:35 -04:00
docs.json Remove fonts which weren't rendering in all browsers (#2174) 2025-10-21 10:00:27 -04:00
updates.mdx Update changelog for 2.12.5 (#2146) 2025-10-19 20:33:35 -04:00