Repository navigation
fix(mcp): bound capture comparison input schema depth - #1005
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 morluto#919
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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
… limits Some model providers reject the whole tool list when any input schema contains a recursive $ref or nests deeper than 10 levels (fixes morluto#919). Sanitize the advertised wire projection: break cyclic $refs, bound nesting depth, and drop unreachable $defs. Canonical Zod contracts are untouched.
|
Thanks, @sx4im, for your work on “fix(mcp): keep advertised input schemas within model function-calling limits.” I appreciate your contribution to REA. |
|
Reviewed the complete sanitizer, SDK schema conversion, runtime validators, generated-catalog handling, and the previous CI failures. I pushed follow-up commits preserving this PR's ancestry and synchronized it with merged #995. The final change replaces generic depth truncation with an explicit producer-result boundary for both passive and recorded scenario captures. Scenario authoring and comparison normalization remain fully advertised; cloned validators retain the complete capture constraints and paired-input refinement. The build-generated catalog is no longer tracked. Verification passed: 66 local tests across 12 files, static checks, generated-document checks, actual packed-package verification, actual stdio discovery of all 134 tools, and real Chrome capture/comparison round trips with exact CLI/MCP parity. Inputs and outputs have zero reachable recursive references, and every input fits the documented structural depth profile. Malformed deep capture data still fails runtime validation. The branch push starts fresh CI for the final head. Muse Spark/opencode was unavailable, so the verification establishes the stated local compatibility profile and actual REA workflows, rather than a model-specific end-to-end claim. |
N0zoM1z0
left a comment
There was a problem hiding this comment.
Final review completed at 82dd85e35af579c1f9739482752395b69397ee70. The targeted producer-result projections retain full runtime validation and complete output evidence; the generic sanitizer and tracked build-generated catalog have been removed. All live/generated inputs satisfy the documented structural profile, and input/output cycle guards cover the entire inventory.
Local verification includes 66 focused tests, static/docs gates, complete packaged-install verification, and actual Chrome capture round trips with CLI/MCP parity and malformed deep-input rejection. All exact-head CI checks are now complete and green, including Windows and both macOS architectures. Muse Spark/opencode itself remains unavailable and unverified, as stated in the PR.
* fix(mcp): advertise JSON values without recursive schemas
`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
* fix(mcp): keep advertised input schemas within model function-calling limits
Some model providers reject the whole tool list when any input schema
contains a recursive $ref or nests deeper than 10 levels (fixes morluto#919).
Sanitize the advertised wire projection: break cyclic $refs, bound nesting
depth, and drop unreachable $defs. Canonical Zod contracts are untouched.
---------
Co-authored-by: Kaoru0822 <[email protected]>
Co-authored-by: sx4im <[email protected]>
Co-authored-by: N0zoM1z0 <[email protected]>
Summary
Fixes #919.
compare_web_capturesembedded full inspection and scenario result schemas, reaching 13 structural levels and blocking clients that reject an entire catalog when one input exceeds ten. Describe these inputs as complete producer-result objects to pass back unchanged, while retaining every nested runtime constraint. Together with merged #995, all 134 tools have cycle-free input/output schemas and inputs within the documented structural depth profile.Problem and expected behavior
The deepest passive path includes WebSocket JSON shapes; recorded scenario history has another depth-13 path. Agents should be able to discover every tool and compare results already returned by REA. Both comparison groups now identify their exact producer; scenario authoring and normalization options remain fully described.
Change and scope
Given earlier and later
inspect_web_pageresponses:Scenario comparison similarly takes complete
capture_browser_scenarioresults inbefore_scenarioandafter_scenario.Contract and boundary impact
Evidence and regression coverage
Full live/generated inventory, root and escaped references, shared acyclic definitions, dialect validity, examples, authority hints, strict inputs, and handler binding with original/reversed catalog ordering.
Incomplete payloads accepted by the advertised object envelope are rejected by the full server parser before the handler runs. A malformed deep WebSocket
typesentry is also rejected through MCP.Actual stdio discovery reports 134 tools, zero reachable input/output cycles, and maximum structural input depth ten.
Real Chrome capture round trips passed for passive inspections and scenario history, with exact CLI/MCP comparison parity and preserved external-browser lifecycle.
Remaining proof gap: Muse Spark/opencode itself was unavailable. The documented profile counts schema structure; the model API's exact undocumented depth rule and any additional limits remain unverified.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run build:cached— passed with bounded local resource settings.npm run check:fast -- --concurrency=1 --env-mode=loose— passed.npm run docs:check -- --env-mode=loose— passed after synchronizing with merged main.npm run verify:package— passed, including actual packed installation, CLI/MCP discovery, setup/update, skill, Evidence, and lifecycle checks.Compatibility, safety, and release
Review checklist
type(scope): outcome.