Skip to content

Return protocol errors for invalid tool arguments#2172

Closed
FU-max-boop wants to merge 1 commit into
modelcontextprotocol:mainfrom
FU-max-boop:fix/tool-argument-protocol-error
Closed

Return protocol errors for invalid tool arguments#2172
FU-max-boop wants to merge 1 commit into
modelcontextprotocol:mainfrom
FU-max-boop:fix/tool-argument-protocol-error

Conversation

@FU-max-boop
Copy link
Copy Markdown

Summary

  • let SDK-generated tool input validation errors propagate as JSON-RPC InvalidParams errors
  • keep tool handler exceptions and output validation failures as tool-level { isError: true } results
  • update Zod/Standard Schema integration coverage and add a changeset

Validation

  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/test-integration test -- test/server/mcp.test.ts test/standardSchema.test.ts
  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/server test
  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/server typecheck
  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/test-integration lint
  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/server lint
  • npx -y pnpm@10.26.1 --filter @modelcontextprotocol/server build
  • npx -y pnpm@10.26.1 run sync:snippets --check

Fixes #2162

@FU-max-boop FU-max-boop requested a review from a team as a code owner May 28, 2026 21:11
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

🦋 Changeset detected

Latest commit: 1a902a5

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

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/server 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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2172

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2172

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 1a902a5

@FU-max-boop
Copy link
Copy Markdown
Author

Closing this as a duplicate of my earlier PR #2169, which already addresses #2162. I carried the useful changeset from this branch into #2169 so review can stay concentrated there. Sorry for the noise.

@FU-max-boop FU-max-boop deleted the fix/tool-argument-protocol-error branch May 28, 2026 21:15
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.

invalid argument should throw protocol error, rather than tool execution error

1 participant