Repository navigation
Conversation
Assisted-by: claude-code/claude-sonnet-5-5 Machine: MacBook-Anton Account: tonydzi Operator: anton
This branch has not been deployed
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.
Fixes #3944
What was broken
The example stdio MCP server (
examples/mcp_server/funasr_mcp.py) exited with status 1 on a line that is not valid JSON, and on atools/callframe whoseparamsis an array. A single bad frame killed the process, so later valid frames were never served.What I changed
main()catches JSON parse errors and answers with JSON-RPC-32700(idnull), then keeps reading stdin.-32600.handle_request()returns-32602whenparams(ortools/callarguments) is not an object. Notifications (noid) get no reply.send_error()helper for protocol-level errors. Tool-level errors still usesend_tool_error.How I checked
Also covered: requests without an
id(notifications) get no reply, a deeply nested line (RecursionError) and invalid UTF-8 bytes are treated as parse errors.Without the fix, the 6 new tests fail (
python3 -m unittest examples.mcp_server.test_funasr_mcp.FunASRMCPMalformedFrameTestgivesFAILED).With the fix, the whole file passes:
python3 -m unittest examples.mcp_server.test_funasr_mcpgivesRan 16 tests ... OK.python3 -m compileall examples/mcp_serveris clean. The two repro commands from the issue now print a JSON-RPC error and exit 0. No model or audio needed.