-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Invalid method names return error code -32602 instead of -32601 #1561
Copy link
Copy link
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesimproves spec complianceWhen a change improves ability of SDK users to comply with spec definitionWhen a change improves ability of SDK users to comply with spec definitionneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.
Metadata
Metadata
Assignees
Labels
P3Nice to haves, rare edge casesNice to haves, rare edge casesimproves spec complianceWhen a change improves ability of SDK users to comply with spec definitionWhen a change improves ability of SDK users to comply with spec definitionneeds confirmationNeeds confirmation that the PR is actually required or needed.Needs confirmation that the PR is actually required or needed.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Initial Checks
Description
How to reproduce:
Expected result:
{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}Actual result:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid request parameters","data":""}}The issue appears to occur because request validation in
mcp/shared/session.py(lines 360-375) catches the validation exception and returns-32602before the proper method-not-found handler inmcp/server/lowlevel/server.py(lines 716-718) can be reached.Example Code
Python & MCP Python SDK