Skip to content

[Client] Answer a server request with an unknown method or invalid params with an error - #762

Open
andre-schade wants to merge 1 commit into
modelcontextprotocol:mainfrom
andre-schade:fix/client-answers-invalid-requests
Open

andre-schade wants to merge 1 commit into
modelcontextprotocol:mainfrom
andre-schade:fix/client-answers-invalid-requests

Conversation

@andre-schade

Copy link
Copy Markdown

When MessageFactory cannot build a server request (unknown method, or params that don't match the request class), Client\Protocol::processMessage() only logged a warning, so the server waited for an answer until its timeout. JSON-RPC requires an error response, and the server side already sends one.

The client now answers with -32601 for an unknown method and -32602 for invalid params, using the request id the exception carries. Other unreadable messages, e.g. a malformed response, are still only logged.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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