Skip to content

fix: tighten request handler result types on v1.x#2105

Open
pragnyanramtha wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
pragnyanramtha:pragnyan/v1x-42-handler-result-types
Open

fix: tighten request handler result types on v1.x#2105
pragnyanramtha wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
pragnyanramtha:pragnyan/v1x-42-handler-result-types

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • add protocol method/result maps and route setRequestHandler return types through fixed-shape results for standard MCP requests
  • include task-capable standard methods such as tools/call, sampling/createMessage, and elicitation/create while preserving custom request fallback typing
  • add compile-time regressions proving invalid {} handler results fail, with positive coverage for task results and structured-content-only tool responses

Fixes #42.

Validation

  • npm run typecheck
  • npx vitest run test/server/index.test.ts test/client/index.test.ts test/server/elicitation.test.ts test/shared/protocol.test.ts -> 324 passed
  • npx vitest run test/server/index.test.ts -> 67 passed
  • npm run lint
  • npm run build
  • git diff --check

Review

  • Independent review found no blockers after the final tools/call and elicitation/create tightening.
  • tasks/result intentionally remains broad because its payload is method-dependent.

@pragnyanramtha pragnyanramtha requested a review from a team as a code owner May 16, 2026 03:21
Copilot AI review requested due to automatic review settings May 16, 2026 03:21
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 16, 2026

🦋 Changeset detected

Latest commit: a43ea63

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@modelcontextprotocol/sdk@2105

commit: a43ea63

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants