Repository navigation
Conversation
98cf7b0 to
834edbb
Compare
834edbb to
25a7293
Compare
e942881 to
5076af0
Compare
|
Hi @mayank609 — thanks for working on #46303. I checked the current PR diff and noticed it contains 242 changed files, including unrelated CI workflows, API files and Web files, although the intended fix is scoped to MCP JSON-list text output and its regression tests. GitHub also currently reports this PR as not mergeable. Could you rebase the fix onto the latest I inspected the remote diff and PR metadata only; I have not run the tests locally. Thanks! |
97445ac to
56eb5d4
Compare
|
@GYJ99 thanks for flagging that. The branch was based on an older main, so the diff picked up unrelated changes. I rebased it onto the latest main and it now touches only the two files for the fix ( |
56eb5d4 to
623a622
Compare
623a622 to
dbd7f63
Compare
Fixes #46303
Summary
When an MCP tool returns a JSON array that contains anything other than objects (strings, numbers, booleans, null, nested arrays),
MCPTool._process_json_listfalls back to a single text message. It was building that text withstr(json_list), so["ok", true, null]became['ok', True, None]. That's Python syntax, which breaks anything downstream that expects the JSON the server actually returned.The fix serializes the list back with
json.dumps(..., ensure_ascii=False). Lists made only of objects are untouched; they still produce one JSON message per item.I added an assertion to the existing helper test in
tests/unit_tests/core/tools/mcp_tool/test_tool.py. It feeds["a", true, null, 1.5, "é"]through_process_text_contentand checks that the text comes back as the same JSON. It fails on main (['a', True, None, 1.5, 'é']) and passes with the change. The whole file passes (50 tests), andruff check/ruff format --checkare clean.Screenshots
N/A (backend only)
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods