Repository navigation
fix(mcp): advertise JSON values without recursive schemas - #995
Conversation
`z.json()` projects a self-referential `$defs/__schema0` entry. Twenty
tool input schemas and 123 output schemas carried it, and clients or
model APIs that reject recursive JSON Schemas refuse the whole tool
list. Every JSON value satisfies `{}`, so the shared JSON value schema
now advertises that. Runtime parsing still admits only JSON values.
Refs #919
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…n-schemas # Conflicts: # docs/product-catalog.json # docs/verification/managed-conformance-manifest.json # skills/reverse-engineer-anything/SKILL.md # src/generatedMcpToolCatalog.ts
…n-schemas # Conflicts: # src/generatedMcpToolCatalog.ts
|
Reviewed the schema projection, runtime parser, SDK registration path, and generated catalog. The shared JSON-value projection is lossless for transport JSON and removes recursive references from both input and output schemas without changing runtime validation. I pushed follow-up commit Local verification passed with the pinned toolchain and a fresh locked dependency install:
The push triggered a new CI run. This addresses the recursion portion of #919; the deep web-capture comparison input still needs a separate follow-up. A real Muse Spark run has not been performed. |
`z.json()` projects a self-referential `$defs/__schema0` entry. Twenty
tool input schemas and 123 output schemas carried it, and clients or
model APIs that reject recursive JSON Schemas refuse the whole tool
list. Every JSON value satisfies `{}`, so the shared JSON value schema
now advertises that. Runtime parsing still admits only JSON values.
Refs morluto#919
Co-authored-by: N0zoM1z0 <[email protected]>
Summary
z.json()projects a self-referential definition:On
main, 20 of 133 tool input schemas and 123 output schemas carry it. Clients and model APIs that reject recursive JSON Schemas refuse the whole tool list (#919:Recursive JSON schemas are not currently supported).Every JSON value satisfies
{}, so the sharedjsonValueSchemanow advertises{}through Zod's per-schematoJSONSchemaoverride. The two contracts that calledz.json()directly (errorSchemas.ts, the MCP doctorcatalogoutput) now usejsonValueSchema. The fix sits on the schema rather than on registration. That covers the live server,z.toJSONSchemausers, the generated catalog, anddocs/error-contract.schema.json.Runtime parsing is unchanged:
jsonValueSchemastill rejectsundefined, non-finite numbers, functions, and nested non-JSON values.This differs from the closed #923, which rewrote cyclic
$refs after projection at registration.Scope
Refs #919, notFixes: this removes the recursion only. Measured after this change over the live tool list ($refs now absent):main$ref$ref$defsat allcompare_web_captures)The reported depth limit of 10 still applies to
compare_web_captures, whose input embeds whole web-capture inspections. The issue leaves the remedy for that to maintainer choice (compact inputs vs. lowering the wire schema), so this PR does not change it.Verification
src/domain/jsonValue.test.ts(new): projection has no$ref/$defsfor input and output, Ajv 2020 accepts nested JSON and still rejects a non-object map; runtime parsing still rejects non-JSON values.tests/boundary/mcp/toolSchemaValidity.test.ts: newrecursiveReferencescheck over the livelistToolsresult andGENERATED_MCP_TOOL_CATALOG. Before regenerating, the catalog assertion failed with 147 recursive references; it passes after.npm run check:changed: typecheck, lint, 135 files / 1303 tests passed.tests/boundary/mcp/*.test.ts(afternpm run build:cached): 56 files passed, 2 skipped.npm run docs:generatethennpm run docs:check: passed.dist/main.jsover real stdio MCP: 133 tools, 0 recursive schemas.Not verified: a real opencode + Muse Spark 1.3 run. No Hopper/Ghidra/IDA verification is relevant.
🤖 Generated with Claude Code