fix(mcp): stop advertising complete Evidence in input examples (#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.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-10 07:10:38 -07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 2d426c924c
commit a53689c55d
5 changed files with 171 additions and 3 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import { z } from "zod";
import type { ToolContract } from "./toolContractTypes.js";
import { advertisedInputExamples } from "./advertisedInputExamples.js";
import { presentInputJsonSchema } from "./inputSchemaPresentation.js";
import { digestCanonicalValue } from "../domain/canonicalDigest.js";
@@ -63,9 +64,10 @@ export const toolInputSchemaWithMetadata = <Contract extends ToolContract>(
...options,
libraryOptions: { reused: "ref", ...options.libraryOptions },
});
const examples = advertisedInputExamples(contract);
return {
...presentInputJsonSchema(shared, fallbackPropertyDescription),
examples: contract.examples.map(({ input }) => input),
...(examples.length === 0 ? {} : { examples }),
};
},
);