Skip to content

Conversation

@mattzcarey
Copy link
Contributor

Summary

  • Client.setRequestHandler() now only accepts server-to-client methods (sampling/createMessage, elicitation/create, roots/list)
  • Server.setRequestHandler() now only accepts client-to-server methods (tools/call, prompts/get, resources/read, etc.)
  • This prevents accidentally registering handlers for wrong method types

Follows up on #1446 with minimal code changes (+12/-4 lines).

Test plan

  • All tests pass (485/485)
  • Type checking passes

🤖 Generated with Claude Code

- Client.setRequestHandler() now only accepts server-to-client methods
  (sampling/createMessage, elicitation/create, roots/list)
- Server.setRequestHandler() now only accepts client-to-server methods
  (tools/call, prompts/get, resources/read, etc.)

This prevents accidentally registering handlers for wrong method types.
@mattzcarey mattzcarey requested a review from a team as a code owner February 3, 2026 10:54
@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2026

⚠️ No Changeset found

Latest commit: 05cfcf6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 3, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1461

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1461

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1461

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1461

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1461

commit: 05cfcf6

@mattzcarey
Copy link
Contributor Author

Superseded by #1463 which uses a cleaner generic type parameter approach instead of @ts-expect-error

@mattzcarey mattzcarey closed this Feb 3, 2026
@mattzcarey mattzcarey deleted the fix/tighten-handler-types-minimal branch February 3, 2026 11:05
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