Merge pull request #448 from koic/handle_non_object_json_rpc_messages
Handle non-object JSON-RPC messages without raising
This commit is contained in:
commit
3d442d0a65
1 changed files with 134 additions and 1 deletions
|
|
@ -259,7 +259,9 @@ module MCP
|
|||
|
||||
parsed = JSON.parse(line.strip)
|
||||
|
||||
next unless parsed.key?("id")
|
||||
# A JSON-RPC message is an object; skip a non-object frame (array or scalar)
|
||||
# the same way as a frame without an id.
|
||||
next unless parsed.is_a?(Hash) && parsed.key?("id")
|
||||
|
||||
return parsed if parsed["id"] == request_id
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue