Repository navigation
fix(mcp): stop advertising complete Evidence in input examples - #1560
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Hosts forward every tool's input schema to the model on each request. Seventeen tools advertised a canonical example that embedded a complete producer Evidence record, up to 22 KB each, accounting for 116 KB of the 450 KB of advertised input schemas. Advertised examples now show an embedded Evidence record as its exact retained-evidence reference when the canonical input accepts one, and omit an example that can only carry inline Evidence. Canonical contract examples, their executable tests, and validation are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kaoru0822-kitauji
force-pushed
the
fix/mcp-advertised-example-evidence
branch
from
October 10, 2026 14:02
b5471d2 to
1d9a95f
Compare
5 of 16 tasks
Collaborator
|
Independent verification of merged #1560 on current main
This does not establish native providers, live model API acceptance or real Copilot/Kimi host behavior. #1554 remains open pending actual supported smaller-model workflow proof; #723 retains the separate per-result/text-and-structured output work. |
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…to#1560) Hosts forward every tool's input schema to the model on each request. Seventeen tools advertised a canonical example that embedded a complete producer Evidence record, up to 22 KB each, accounting for 116 KB of the 450 KB of advertised input schemas. Advertised examples now show an embedded Evidence record as its exact retained-evidence reference when the canonical input accepts one, and omit an example that can only carry inline Evidence. Canonical contract examples, their executable tests, and validation are unchanged.
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.
Problem
Users report that REA uses too much context. Hosts send every tool's name, description and
inputSchemato the model with each request, so the advertised input catalog is a fixed cost on every turn.Measured with the pinned SDK 2.3.1 client against the stdio server built from
main(2ec93ba). All 139 tools; compact UTF-8 bytes:inputSchemasexamplesin input schemasRoot examples made up 29% of the advertised input schemas. 17 tools had an example that embedded a complete producer Evidence record:
compare_javascript_export_shapes(22 KB),compare_application_versions(21 KB),reconcile_javascript_runtime,correlate_static_and_runtime,compare_source_to_bundle,trace_application_feature,trace_javascript_semantics,compare_process_captures,find_changed_behaviorand others. Together these were 116 KB. An agent never writes such an example by hand. It passes Evidence it already received, and the example shows nothing about choosing arguments that the schema and descriptions don't already state. It can also lead an agent to paste whole Evidence inline when a retained reference would work.Change
The advertised projection (
toolInputSchemaWithMetadata) now buildsexampleswith a new helper,advertisedInputExamples(src/contracts/advertisedInputExamples.ts):{"kind":"retained-evidence","evidence_id":...}reference, but only when the canonical input schema accepts that form. This applies to the five JavaScript application workflows, which takeevidenceInputSchema.exampleskeyword is omitted for them.Unchanged: canonical
contract.examples(still executed by boundary tests), canonical validation, the advertised validation keywords, property descriptions, output schemas, the tool inventory and the compact profile.docs/mcp-contracts.mddocuments the rule.Not in scope: per-result size and the duplication between text and structured content (#723), and the remaining validation structure of large input schemas such as
compare_web_captures(52 KB).Relates to #723, #1065, #1554. This reduces the static catalog cost #1554 hit, but on its own it may not clear that client's limit: the issue reports that omitting root examples alone still failed with
gpt-4.1metadata.Verification
npm run check:changedandnpm run check:fastpassnpm run docs:checkpassesnpm run test:focused -- tests/boundary/mcp/*.test.ts: 85 files passed, 2 skipped (330 tests)src/contracts/advertisedInputExamples.test.tscovers:toolSchemaValiditynow asserts the advertised examples equal the projection, and still checks every canonical example against the advertised schema with Ajv.No real Hopper/Ghidra/IDA verification was performed (they are not affected). No real host-client lanes (Copilot, Kimi) were run. Byte counts are wire measurements, not model token counts.
🤖 Generated with Claude Code