-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When a client attempts to call a tool that does not exist the specification requires that a protocol error is raised as a JSON-RPC Error. Instead, the current SDK returns a JSON-RPC Result with isError = true.
To Reproduce
Steps to reproduce the behavior:
- Call a missing tool
Expected behavior
As per the specification, the result should be:
{
"jsonrpc": "2.0",
"id": 3,
"error": {
"code": -32602,
"message": "Unknown tool: nonexistent_tool"
}
}
while actually it's
{
"jsonrpc": "2.0",
"id": "3",
"result": {
"content": [
{
"type": "text",
"text": "MCP error -32602: Tool nonexistent_tool not found"
}
],
"isError": true
}
}
Additional context
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/packages/server/src/server/mcp.ts#L201-L204
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/packages/server/src/server/mcp.ts#L211-L227
are at fault.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working