Repository navigation
Treat JSON-null MCP result/error members as omitted - #337
Merged
Merged
Conversation
parse_response treated a present JSON-null member as a real result or error, so serializers that emit "error": null on success (or "result": null on error) threw. Client::rpc counted that as a parse failure and killed the MCP subprocess after five such lines. Match A2A: null means omitted; dual non-null members still reject. Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
This was referenced Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
parse_responsetreated a present JSON-nullresultorerrormember as a real value. A serializer (or proxy) that emits{"jsonrpc":"2.0","id":1,"result":{...},"error":null}on success — or"result":nullon error — threwresponse has both 'result' and 'error'.Client::rpccounts that throw as a parse failure, skips the line, and kills the MCP subprocess after five such envelopes./mcptools then fail until the session is rebuilt. A2A already treats JSON-null as omitted (rpc_response_from_json); MCP did not.Fix
Treat JSON-null
result/erroras omitted for the exclusivity check. Dual non-null members still reject. A successful method that returns JSONnullstill keepsresult(distinct from a notification with no result member).Tests
unit_mcp— success +error:null, error +result:null, successfulresult:null,error:nullonly, and the existing dual-object reject. Parse cases 4/4 locally; fullunit_mcp49/49.Independently mergeable against
main(0456350). Code hunks (src/mcp/types.cpp,tests/test_mcp.cpp) do not overlap #321–#336. CHANGELOG[Unreleased]will need a rebase after whichever sibling merges first.