Repository navigation
Conversation
wrapMcpTool converted the server's inputSchema to Zod and the wire parameters were regenerated from that Zod schema, which added a pattern per string format, safe-integer bounds, and additionalProperties, and inlined $ref/$defs. Keep both: serialize the server's schema, validate with the Zod one. Linear: DEV-1380
This was referenced Nov 8, 2026
This branch has not been deployed
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.
Linear: DEV-1381
Problem
wrapMcpToolconverts an MCP tool'sinputSchemato Zod (z.fromJSONSchema).convertToolsToAPIFormatthen regenerates the model-facingparametersfrom that Zod schema (z.toJSONSchema, draft-07). Zod prints everything its validators check, so the model receives constraints the server never declared:"format": "date-time"formatplus a 400-characterpattern(date203,uuid166,email96)"type": "integer""minimum": -9007199254740991, "maximum": 9007199254740991$ref+$defsadditionalProperties"additionalProperties": {}$schema2020-12$schemadraft-07Change
MCP tools keep both schemas:
function.wireInputSchemaand serialized verbatim (still sanitized of~-prefixed keys).inputSchemais unchanged and still validates call arguments beforecallTool.wireInputSchemaalready existed for manual tools (#118). It moves fromManualToolFunctiontoBaseToolFunction,convertToolsToAPIFormatdrops the manual-only check, andmarkMcpaccepts it as an option next toloopKey. The publictool()config still acceptswireInputSchemafor manual tools only.A server schema whose root is not
type: "object"keeps the old behavior: the Zod conversion degrades it to an object, and that object is serialized.Behavior change to review
Providers now receive the MCP server's schema as written. Before, the Zod pass normalized it to draft-07. A server schema that uses keywords a provider rejects (for example
prefixItems) now reaches that provider unchanged. Before, such a schema was either rewritten to draft-07 or, where Zod could not convert it, replaced per property withz.unknown().Validation is not loosened: the Zod schema still applies its own checks (format regexes, safe-integer bounds) to the model's arguments, as before.
How to test
pnpm --filter @openrouter/agent test—tests/unit/mcp/wire-input-schema.test.tscovers: the server's schema reachesparametersunchanged forformat,integer,prefixItemsand$ref/$defs; arguments are still validated by the Zod schema; a non-object root falls back to the Zod-derived object.