Description
File: mempalace/mcp_server.py, lines 679 and 683
Problem:
json.dumps(response) is called without ensure_ascii=False.
Trigger:
Any string field (content, wing, room, etc.) contains Chinese (or other non-ASCII) characters.
Error Chain:
- WorkBuddy sends a JSON-RPC request containing Chinese characters.
- The MCP protocol stack parses the JSON, decoding Chinese into Python strings with lone surrogate characters (e.g.
\udca3).
- The string is passed as-is to the handler → returns a
result dict.
json.dumps(result) fails during serialization because UTF-8 cannot encode the surrogate characters → error is raised.
Expected Behavior:
The server should correctly return JSON containing Chinese characters without crashing.
Suggested Fix
Add ensure_ascii=False when calling json.dumps():
# Before
json.dumps(response)
# After
json.dumps(response, ensure_ascii=False)
Description
File:
mempalace/mcp_server.py, lines 679 and 683Problem:
json.dumps(response)is called withoutensure_ascii=False.Trigger:
Any string field (
content,wing,room, etc.) contains Chinese (or other non-ASCII) characters.Error Chain:
\udca3).resultdict.json.dumps(result)fails during serialization because UTF-8 cannot encode the surrogate characters → error is raised.Expected Behavior:
The server should correctly return JSON containing Chinese characters without crashing.
Suggested Fix
Add
ensure_ascii=Falsewhen callingjson.dumps():