-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Invalid JSON RPC requests do not respond with an error #563
Copy link
Copy link
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingfix proposedBot has a verified fix diff in the commentBot has a verified fix diff in the commentimproves 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 definitionready for workEnough information for someone to start working onEnough information for someone to start working on
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingfix proposedBot has a verified fix diff in the commentBot has a verified fix diff in the commentimproves 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 definitionready for workEnough information for someone to start working onEnough information for someone to start working on
I noticed that this request:
{"jsonrpc": "2.0", "id": 1, "method": "tools/lit", "params": {}}... returns an error response (code -32601) as expected but this:
{"jsonrpc": "2.0", "id": 1, "method_": "tools/list", "params": {}}... returns nothing. I would expect that a missing
methodproperty or an unknown root property likemethodXwould throw and error. The JSON-RPC 2.0 spec says the server should return:method)I think the SDK should handle these but I'm not even able to write validation logic in my application code because an invalid RPC request never reaches my handler.
Claude tells me I can do something like this:
.. but I don't love that.
If a maintainer agrees that this validation should be in the SDK, I'd be more than happy to write a PR! Thank you for all your work on this!