fastmcp/tests/server/middleware
claude[bot] d346dc66e7 fix: preserve key field in ResponseCachingMiddleware for prefixed tools/resources/prompts
The ResponseCachingMiddleware was losing prefix information when caching
tools, resources, and prompts from mounted/imported servers. The root cause
was that the private _key attribute wasn't being serialized by Pydantic.

Changes:
- Add model_serializer to FastMCPComponent to include _key in serialization
- Update model_validate to restore _key from deserialized data
- Add key parameter when creating cached Tool/Resource/Prompt objects
- Add comprehensive test for mounted server prefix preservation

Fixes #2300

Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-10-29 15:24:33 +00:00
..
__init__.py Add single-component methods 2025-06-18 19:47:19 -04:00
test_caching.py fix: preserve key field in ResponseCachingMiddleware for prefixed tools/resources/prompts 2025-10-29 15:24:33 +00:00
test_error_handling.py transform NotFoundError to standard MCP error (#2133) 2025-10-18 11:46:57 -04:00
test_initialization_middleware.py Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00
test_logging.py Implement icon support (#2121) 2025-10-17 17:28:08 -04:00
test_middleware.py Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00
test_rate_limiting.py Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00
test_timing.py Use lowercase namespace for fastmcp logger (#1791) 2025-09-26 12:13:02 -04:00
test_tool_injection.py Add ToolInjectionMiddleware + Tools for Read/List Resource/Prompt for Client Compat (#2142) 2025-10-24 18:06:58 -04:00