Skip to content

fix(client): preserve _meta on input_required results - #2862

Merged
felixweinberger merged 4 commits into
modelcontextprotocol:mainfrom
SyedTashfin:fix/input-required-meta-passthrough
Sep 28, 2026
Merged

felixweinberger merged 4 commits into
modelcontextprotocol:mainfrom
SyedTashfin:fix/input-required-meta-passthrough

Conversation

@SyedTashfin

Copy link
Copy Markdown
Contributor

Fixes #2861.

A server that puts result-level _meta on an input_required result loses it before the client can see it: with allowInputRequired: true the 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, the input_required branch
  • packages/core-internal/src/shared/inputRequiredEngine.ts — manualInputRequiredValue

Result._meta is a result-level field — stampServerInfoMeta runs "for every result regardless of resultType" — and the wire InputRequiredResultSchema carries it, so the loss is decode-only and the encode side already ships it.

Changes

  • DecodedResult's input_required variant carries _meta?: ResultMetaObject.
  • Both sites above pass it through when the peer sent it.

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.
  • Both fail against the unpatched source (expected undefined to deeply equal …) and pass with it.
  • pnpm typecheck:all, pnpm lint:all, pnpm build:all and pnpm -r --filter '!@modelcontextprotocol/test-e2e' test pass locally.

Changeset included. If you want this covered in modelcontextprotocol/conformance too, I can add a scenario that round-trips _meta on an input_required result.

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.

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.
@SyedTashfin
SyedTashfin requested a review from a team as a code owner September 24, 2026 22:47
Copilot AI lite review requested due to automatic review settings September 24, 2026 22:47
@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: da6fcd6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/client Patch
@modelcontextprotocol/codemod Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/core-internal Patch

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2862

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2862

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2862

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2862

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2862

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2862

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2862

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2862

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2862

commit: da6fcd6

@claude claude Bot added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Sep 25, 2026
@felixweinberger
felixweinberger merged commit e780e13 into modelcontextprotocol:main Sep 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client drops _meta from input_required results when allowInputRequired: true (2026-07-28)

3 participants