fastmcp/tests/utilities
Jeremiah Lowin 54657de2e0
Keep $ref pointers when inlining would produce an oversized schema (#5421)
`dereference_refs` inlines local `$ref` pointers when tools and resource templates are listed (`dereference_schemas=True`). Inlining is a good default for ordinary schemas, but some definition graphs are far larger once fully expanded than they are as written. For those, keeping `$defs` is the better result for clients and for the server.

`dereference_refs` now measures the expanded size before inlining, checks the structure `jsonref` builds, and checks the final text size. Schemas that would exceed 100,000 nodes, 128 levels or about 5 million characters use the existing behavior for circular schemas: the root `$ref` is resolved, and `$defs` and nested `$ref` pointers are kept. Sibling keywords are now merged from the definition each pointer resolves to. Typical Pydantic and MCP schemas are well under these limits; the largest MCP protocol model schema measures about 25,000 nodes.

Co-authored-by: Bill Easton <williamseaston@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-10-04 11:06:02 -04:00
..
json_schema_type Key cached schema adapters by the normalized schema (#5436) 2026-10-04 10:34:06 -04:00
openapi fix(openapi): rewrite model references in prefixItems (#5131) 2026-09-22 13:48:34 -05:00
__init__.py restore 1.x code 2025-04-09 11:54:42 -04:00
httpx2_mock.py Add server-side identity assertion (SEP-990 ID-JAG) (#4483) 2026-07-18 19:52:15 -04:00
test_asgi_transport.py Merge remote-tracking branch 'origin/main' into feature/client-auto-default 2026-07-20 12:02:38 -04:00
test_async_utils.py Stop gather() from creating coroutines it may never schedule (#4559) 2026-07-20 11:01:30 -04:00
test_auth.py feat: option to add upstream claims to the FastMCP proxy JWT (#2997) 2026-01-28 15:57:24 -05:00
test_cli.py Fix path resolution in install commands (#1951) 2025-09-29 20:04:12 -04:00
test_components.py Stabilize upgraded ty checks (#4526) 2026-07-17 17:46:53 -04:00
test_docstring_parsing.py Extract parameter descriptions from docstrings (#3872) 2026-04-12 13:43:48 -04:00
test_http.py Add targeted coverage tests (#4230) 2026-05-25 18:57:28 -04:00
test_inspect.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_inspect_icons.py Include instructions in MCP inspect output (#4873) 2026-08-21 19:50:27 -05:00
test_json_schema.py Keep $ref pointers when inlining would produce an oversized schema (#5421) 2026-10-04 11:06:02 -04:00
test_json_schema_expansion.py Keep $ref pointers when inlining would produce an oversized schema (#5421) 2026-10-04 11:06:02 -04:00
test_logging.py Avoid loading MCP and CLI stacks during lightweight imports (#4763) 2026-08-05 10:56:13 -04:00
test_skills.py Write downloaded skill text as UTF-8 (#4715) 2026-08-02 09:33:32 -04:00
test_tests.py Fix typos (#4498) 2026-07-18 21:18:39 -04:00
test_timeout.py Add targeted coverage tests (#4230) 2026-05-25 18:57:28 -04:00
test_token_cache.py Extract TokenCache utility, add caching to GitHubTokenVerifier (#3547) 2026-03-18 15:26:09 -04:00
test_typeadapter.py Fix method-bound tools (#1360) 2025-08-04 09:41:05 -04:00
test_types.py types: map Image jpg/svg/tif formats to canonical MIME types (#5294) 2026-09-26 21:14:22 -05:00
test_version_check.py fix: validate cached version timestamp types (#5351) 2026-09-30 11:08:58 -04:00