fix(client): pin output schema for in-flight tool calls (v1.x) - #2708
Open
OllieinCanada wants to merge 1 commit into
Open
fix(client): pin output schema for in-flight tool calls (v1.x)#2708OllieinCanada wants to merge 1 commit into
OllieinCanada wants to merge 1 commit into
Conversation
Capture the cached validator before dispatching tools/call so a concurrent listTools refresh cannot validate a response against a newer schema generation. Add a deterministic regression covering both the in-flight and subsequent-call behavior.
🦋 Changeset detectedLatest commit: a992ad4 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Summary
tools/call@modelcontextprotocol/sdkWhy this ordering matters
Client.callTool()currently checks required-task metadata before sending the request, but reads the output validator only after the response arrives. A concurrentlistTools()refresh can replace that cache in between, so a valid response may be rejected against a schema that did not exist when the call was dispatched.The validator is immutable for the lifetime of a call now: it is captured alongside the other dispatch-time metadata, without preventing later calls from using a refreshed catalog.
Fixes #2612.
Validation
McpError -32602against the newer schemanpm run typechecknpx eslint src/npx prettier --check .npx tsc -p tsconfig.prod.jsonnpx tsc -p tsconfig.cjs.jsonLocal full-suite note
On this Windows host (Node 20.9.0), the resource-safe full run completed with 1,612 passing tests and four unrelated integration timeouts in
processCleanup.test.tsand the Zod v3 half oftaskResumability.test.ts; Windows stdio teardown also emitted two pipe errors. The installed Vite/Undici dev dependencies warn that this local Node version is below their current supported 20.x patch level. The changed client suite is green, and the upstream Linux CI matrix is the authoritative full-suite result.