| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
⚠️ No Changeset foundLatest commit: 8178fb0 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 changesetsWhen 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 |
Sorry, something went wrong.
|
@modelcontextprotocol/client
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1567
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1567
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1567
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1567
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1567 commit: 8178fb0 |
Sorry, something went wrong.
Per MCP spec, calling a nonexistent tool should return a JSON-RPC Error (code -32602), not a JSON-RPC Result with isError: true. Previously, only UrlElicitationRequired errors were re-thrown; all other ProtocolErrors (including tool/disabled checks) were swallowed and wrapped in a CallToolResult. Now all ProtocolErrors propagate as JSON-RPC errors, which is the correct behavior per the specification. Fixes modelcontextprotocol#1510
… error wrapping Tool not found/disabled errors should be JSON-RPC errors (thrown before try-catch), while validation errors from validateToolInput/Output should remain wrapped as CallToolResult with isError:true.
|
Hi, thank you for this. The TS SDK is currently identical with the Python SDK - see modelcontextprotocol/modelcontextprotocol#2145 opened against the spec. Will let this PR on hold for a little bit to see what happens with the spec PR; if it gets rejected, will merge this. |
Sorry, something went wrong.
|
Thanks for this! Closing in favor of #1389. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fix tool not found errors to return JSON-RPC Error instead of JSON-RPC Result with isError: true, per MCP specification.
Problem
When a client calls a nonexistent tool, the current implementation returns:
{ "jsonrpc": "2.0", "id": "3", "result": { "content": [ { "type": "text", "text": "MCP error -32602: Tool nonexistent_tool not found" } ], "isError": true } }But the MCP specification requires:
{ "jsonrpc": "2.0", "id": 3, "error": { "code": -32602, "message": "Unknown tool: nonexistent_tool" } }Root Cause
The tools/call handler's catch block only re-threw UrlElicitationRequired errors. All other ProtocolError instances (including tool not found, tool disabled, invalid params, etc.) were caught and wrapped in a CallToolResult with isError: true.
Fix
Changed the catch block to re-throw all ProtocolError instances, not just UrlElicitationRequired. This ensures protocol-level errors are returned as JSON-RPC errors per the spec.
Tests
Updated the existing test for nonexistent tools to expect a thrown error instead of a CallToolResult with isError: true.
Fixes #1510