fix(client): preserve _meta on input_required results - #2862
Merged
felixweinberger merged 4 commits intoSep 28, 2026
Merged
felixweinberger merged 4 commits into
felixweinberger merged 4 commits into
Conversation
The 2026-07-28 decode seam rebuilt the input_required payload from inputRequests and requestState only, so result-level `_meta` — including the `io.modelcontextprotocol/serverInfo` stamp servers send — was dropped before an `allowInputRequired: true` caller could see it. `Result._meta` is a result-level field, so `input_required` carries it like any other result, and the encode side already stamps it in `stampServerInfoMeta`. Pass it through the seam in `decodeResult` and `manualInputRequiredValue`, and cover both with tests that fail without the src change.
🦋 Changeset detectedLatest commit: da6fcd6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
felixweinberger
approved these changes
Sep 28, 2026
This was referenced Sep 28, 2026
Merged
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.
Fixes #2861.
A server that puts result-level
_metaon aninput_requiredresult loses it before the client can see it: withallowInputRequired: truethe caller receives{ resultType, inputRequests, requestState }and nothing else.The 2026-07-28 decode seam rebuilds that payload by hand instead of lifting the body, in two places:
packages/core-internal/src/wire/rev2026-07-28/codec.ts—decodeResult, theinput_requiredbranchpackages/core-internal/src/shared/inputRequiredEngine.ts—manualInputRequiredValueResult._metais a result-level field —stampServerInfoMetaruns "for every result regardless ofresultType" — and the wireInputRequiredResultSchemacarries it, so the loss is decode-only and the encode side already ships it.Changes
DecodedResult'sinput_requiredvariant carries_meta?: ResultMetaObject.Testing
packages/core-internal/test/shared/inputRequiredFunnel.test.ts: new case asserting the handed-back value keeps the server's_meta.packages/client/test/client/inputRequiredEngine.test.ts: new manual-mode case through a scripted 2026-07-28 server.expected undefined to deeply equal …) and pass with it.pnpm typecheck:all,pnpm lint:all,pnpm build:allandpnpm -r --filter '!@modelcontextprotocol/test-e2e' testpass locally.Changeset included. If you want this covered in
modelcontextprotocol/conformancetoo, I can add a scenario that round-trips_metaon aninput_requiredresult.Note on how this was written: an agent drafted the change and tests; I read every line of the diff and can answer for it in review.