Skip to content

Comments

fix(mcp): preserve non-ASCII text in JSON serialization#7256

Open
akios-ai wants to merge 1 commit intomicrosoft:mainfrom
akios-ai:fix/mcp-json-ensure-ascii
Open

fix(mcp): preserve non-ASCII text in JSON serialization#7256
akios-ai wants to merge 1 commit intomicrosoft:mainfrom
akios-ai:fix/mcp-json-ensure-ascii

Conversation

@akios-ai
Copy link

json.dumps calls in MCP tool serialization were missing ensure_ascii=False, causing non-ASCII text (Japanese, CJK, etc.) to be escaped into \uXXXX sequences. This makes tool output unreadable when non-ASCII content is involved. Two call sites fixed in _base.py and _elicitation.py. Fixes #6995

json.dumps calls in MCP tool return_value_as_string and
StreamElicitor.elicit were missing ensure_ascii=False, causing
non-ASCII characters (Japanese, Chinese, Korean, etc.) to be
escaped as \uXXXX sequences. This degrades LLM performance
when working with non-English text since models handle native
characters better than unicode escapes.

Fixes microsoft#6995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP tool JSON serialization lacks ensure_ascii=False, degrades LLM performance for Japanese text

2 participants