Repository navigation
fix(mcp): give the compact any-value schema an item schema - #3842
kaoru0822-kitauji wants to merge 2 commits into
Conversation
The compact input-schema profile advertises an unconstrained JSON value
as {type: [null, boolean, object, array, number, string]}. That union
declares an array type without items, which strict clients reject: VS
Code Copilot refused build_call_path with "tool parameters array type
must have items", and 21 tool input schemas carried the same shape.
Use one owned any-value schema that adds items: {} for both the
budget-inlined empty schema and reduced array items.
Fixes #3838
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge, with the previous test gap addressed and no new blocking issues found. SummaryThe PR adds
Reviews (2) · Last reviewed commit: "test(mcp): force the reduced form when c..." · Reviewed by Greptile |
Use a large nested property with a 1 KiB budget so the schema is reduced while its shallow array property remains, and assert the presentation and that property before checking for missing items. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Flagging one gap in the new test: the 64-byte leg can't fail.
Minimal fix: keep the 64-byte leg but assert the fallback stays honest (declare no arrays at all — count the arrays that do have items too, not just the broken ones), and add a leg with a budget that forces the reduced path while keeping properties, asserting |
baron
left a comment
There was a problem hiding this comment.
Source review: adding items: {} to the explicit any-JSON-value projection is compatible with the declared JSON Schema semantics and preserves nested arbitrary arrays. The inline/reduced tests exercise both producing paths; no blocking source issue found. HOLD, not approval: this exact head currently has failed Test shard (5/5), Portable tests, and CI required in run 38681949546. Logs identify tests/boundary/cli/clientProfileLifecycle.test.ts > selected client profiles lifecycle follows the selected roots timing out after 30000ms. I have not established whether that is pre-existing or flaky, and it must be green before approval. Review together with #3806, which also modifies compactInputSchema, then rerun final integration/current-head CI after any reconciliation. Local execution was unavailable because this environment has no installed repository dependencies.
Give array unions an unrestricted item schema and validate converted tools/list schemas for both advertised profiles. Keep client constraints separate from JSON Schema validity. Refs: #3838, #3921, #3842 Co-authored-by: Kaoru0822 <[email protected]> Co-authored-by: 冰水泡枸杞 <[email protected]>
Fixes #3838
Root cause
The compact input-schema profile (
REA_MCP_INPUT_SCHEMA_PROFILE=compact) writes an unconstrained JSON value as an explicit type union,{"type":["null","boolean","object","array","number","string"]}, so that Kimi doesn't inferstringfrom{}. The union declares an array type with noitems. Strict clients reject that. VS Code Copilot fails to load the whole catalog with:I listed tools from the real stdio server on
mainwith the compact profile, and 21 tool input schemas carry this shape. That includesbuild_call_pathat/properties/functions/items, exactly as reported, pluscapture_browser_scenario,correlate_static_and_runtime,trace_application_feature,find_changed_behaviorand others. The defaultfullprofile has none on currentmain. Setup appliescompactautomatically only for Kimi, so the reporter most likely set it explicitly, for example as the gateway workaround suggested in #2999.Change
compactInputSchema.tsnow owns a single any-value schema,{ type: [...all JSON types], items: {} }. It is used by both producers:itemsof an array property (which was already added there for the outer array, but its item type union still lackeditems).items: {}accepts every element, so validation is unchanged.Validation
The public stdio MCP server,
tools/list, scanning every advertised input and output schema for anarraytype withoutitems:maincompactbuild_call_path)full(default)Size / tokens (compact profile, 207 tools): input schemas go from 85,172 to 85,403 B (+231 B, +0.27%), and the full
tools/listpayload from 2,547,347 to 2,547,578 B. The same 27 tools are still reduced-form, so no schema crosses its compact budget.Tests:
compactInputSchema.test.tsexpectations now includeitems: {}. Ajv also accepts nested arrays ([[1], "x"]) for the any-value property.gives every advertised array type an item schema for strict clientswalks compacted schemas at both a large and a tiny budget (inline and reduced) and asserts that no array type lacksitems. It and the two updated tests fail onmain; I checked by restoring main's producer.compactInputSchemaMcp,toolInputAdmission,serverIdentity,mcpDoctor,kimiClientConfiguration, themcpInputSchemaProfileconformance tests (6 files, 72 tests), andnpm run check:fast.Not verified: I did not run VS Code Copilot itself. The verification is the structural rule it reports ("array type must have items") checked over the real server's advertised catalog.
🤖 Generated with Claude Code