Issues: Fix JSON Serialization and add Corresponding Test #6997
nambili-samuel
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I enjoy contributing to projects, whether by fixing small bugs or tackling larger issues.
This small fix addresses a bug in the MCP tool (autogen_ext/tools/mcp/_base.py) where JSON serialization did not set ensure_ascii=False.
Problem:
Non-ASCII characters, including Japanese, were escaped as Unicode codepoints (e.g., "\u65e5\u672c").
Escaped characters reduce readability and can degrade LLM understanding and generation quality in non-English environments.
Solution:
Updated JSON serialization in _base.py to include ensure_ascii=False.
Added a new test (test_mcp_json_serialization.py) to verify that non-ASCII characters (e.g., Japanese text) are serialized correctly without escaping.
Files Changed:
(1) python/packages/autogen-ext/src/autogen_ext/tools/mcp/_base.py
(2) python/packages/autogen-ext/tests/tools/test_mcp_json_serialization.py
Impact:
Fixes JSON serialization for non-ASCII characters.
Ensures improved LLM compatibility in multilingual environments.
Testing:
Added unit tests for Japanese characters serialization. Verified existing functionality is unaffected.
Beta Was this translation helpful? Give feedback.
All reactions