Skip to content

MCP diary_write fails with non-ASCII characters (Chinese, ×, →, ★) in entry #929

@kumhou

Description

@kumhou

Bug Report

Summary

mempalace_diary_write MCP tool returns Internal tool error (-32000) when the entry parameter contains non-ASCII characters such as Chinese text, ×, , or . The same call succeeds when the entry is plain ASCII.

Environment

  • mempalace version: 3.3.0
  • Platform: Windows 10 (via Claude Code plugin)
  • Python: 3.10.7
  • MCP client: Claude Code

Steps to Reproduce

Call mempalace_diary_write via MCP with a non-ASCII entry:

{
  "agent_name": "claude",
  "entry": "SESSION:2026-04-16|test|hook.fire×3|root.cause:chromadb.stale→reconnect.fix|JH:重要更动先确认★★★",
  "topic": "operations"
}

Result: MCP error -32000: Internal tool error

Call the same tool with an ASCII-only entry:

{
  "agent_name": "claude",
  "entry": "SESSION:2026-04-16|test|hook.fire.x3|chromadb.stale.reconnect.fix",
  "topic": "operations"
}

Result: Success

Additional Context

Calling tool_diary_write directly via Python (bypassing MCP transport) works fine with non-ASCII characters. The issue appears to be in the MCP transport layer's handling of Unicode in tool arguments.

from mempalace.mcp_server import tool_diary_write
# This works fine:
tool_diary_write(agent_name='claude', entry='SESSION:2026-04-16|test|hook.fire.confirmed★★★', topic='operations')

Simulating the MCP request via handle_request also works:

from mempalace.mcp_server import handle_request
req = {
    'jsonrpc': '2.0', 'id': 1, 'method': 'tools/call',
    'params': {'name': 'mempalace_diary_write', 'arguments': {
        'agent_name': 'claude',
        'entry': 'SESSION:2026-04-16|stop-hook-test|MCP.diary.write.debug★',
        'topic': 'operations'
    }}
}
handle_request(req)  # succeeds

This suggests the failure is specific to how the live MCP server process receives and handles the characters — possibly a stdio encoding issue on Windows.

Workaround

Use ASCII-only characters in diary entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/i18nMultilingual, Unicode, non-English embeddingsarea/mcpMCP server and toolsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions