mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-10-31 08:11:26 +01:00
`ToolInjectionMiddleware` contributes its tools to the server's own tool lookup. The server lists injected tools ahead of its provider tools and resolves them in `get_tool()`, so they take the same path as registered tools: a tool's `auth` check decides whether it is listed and callable, and every middleware in the chain, including `AuthMiddleware`, extension tool-call interceptors, and error masking, applies to injected tool calls. This holds wherever `ToolInjectionMiddleware` sits in the chain. Injected tools on a mounted server are also callable through the parent, consistent with how they are listed there. An injected tool takes precedence over a registered tool with the same name, and the first injection middleware added takes precedence over later ones. The shadowed registered tool is not listed, so listing and calling agree. Injected tools are matched by name and follow their task configuration like registered tools. Server and session visibility settings still do not apply to injected tools. Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_caching.py | ||
| test_caching_guards.py | ||
| test_dereference.py | ||
| test_discovery_middleware.py | ||
| test_error_handling.py | ||
| test_initialization_middleware.py | ||
| test_logging.py | ||
| test_message_visibility.py | ||
| test_middleware.py | ||
| test_middleware_nested.py | ||
| test_ping.py | ||
| test_rate_limiting.py | ||
| test_response_limiting.py | ||
| test_timing.py | ||
| test_tool_injection.py | ||
| test_versioned_caching.py | ||