Repository navigation
Conversation
opencode rejects the MCP tool list with 'Recursive JSON schemas are not currently supported'. Every z.json() generic-JSON node projects a self-referential defs/__schema0 loop, 141 cases across inputs and outputs. Break the loop at the single registration choke point so both the live server and the generated catalog stay cycle-free; runtime Zod parsing is unchanged. Fixes morluto#919
Owner
|
Thanks, @advokat11, for your work on “fix(mcp): strip recursive refs from advertised tool schemas.” I appreciate your contribution to REA. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Strict MCP clients (opencode) refuse the tool list with
Recursive JSON schemas are not currently supported.Every
z.json()generic-JSON node projects a self-referential$defs/__schema0loop — 141 cases across tool inputs (20 tools) and outputs (121 tools). The fix breaks the loop at the single registration choke point (toolRegistrationOptions), so both the live server and the regeneratedgeneratedMcpToolCatalog.tsare cycle-free. Runtime Zod parsing is untouched; only the advertised wire shape relaxes cyclic$refs to free-form{}.Fixes #919
Verification:
listTools: recursive defs 141 → 0, schemas remain Ajv-validtests/boundary/mcp/toolSchemaValidity.test.ts: +1 regression test (no recursive $refs), 6/6 passtoolRegistrationOptions.test.ts+contractSnapshot.test.ts: passnpm run mcp-catalog:generate