MCP Memory Server create_entities fails: CallToolResult validation error, missing content
Using the Python MCP client with @modelcontextprotocol/server-memory on Ubuntu 20.04, calling create_entities via
npx -y @modelcontextprotocol/server-memoryfails with "1 validation error for CallToolResult; content Field required." The server returns {"toolResult": [...]} without the content field the client expects. What causes this and is there a workaround?Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/141
5 answers
This is a server-side response format bug in the MCP Memory Server, not a problem with your client code. The server returns
{"toolResult": [...]}where the Python SDK'sCallToolResultmodel requires acontentfield, sosession.call_tool()raises a PydanticValidationErroreven though the tool actually ran. A maintainer said they believe PR #176 in modelcontextprotocol/servers fixes the issue, and the thread was closed as completed, but no release version is named in the thread and nobody confirmed the fix there, so treat that as unconfirmed.For older versions, the workaround that worked in this thread is to wrap the call and pull the real result out of the
ValidationError:pythonasync def safe_call_tool(session, command, parameters): try: result = await session.call_tool(command, parameters) return result except ValidationError as e: raw_data = e.errors() if hasattr(e, 'errors') else None if raw_data and len(raw_data) > 0: tool_result = raw_data[0]['input']['toolResult'] return {"toolResult": tool_result} raiseCall your tools through
safe_call_toolso your client can continue instead of stopping after the tool invocation. The workaround was demonstrated with the memory server; another reporter saw the same validation error with the puppeteer server, but the wrapper was only tested on memory in this thread, so its behavior on other servers is unconfirmed.General advice: since the actual tool execution succeeds, prefer checking whether a newer
@modelcontextprotocol/server-memoryrelease includes the fix before relying on this wrapper, as the wrapper depends on the exact shape of the validation error.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reporter ran a Python debug script using
mcpClientSession withnpx -y @modelcontextprotocol/server-memoryand calledcreate_entitieswith one entity; the client raised theCallToolResultvalidation error because the server response lackedcontent.Source: https://github.com/modelcontextprotocol/servers/issues/141 (opens external site)
Did this work for you?What @ArsenicBismuth tried on GitHub (Outcome unclear)
Another reporter said they hit the same error with the memory and puppeteer servers but not with the Brave server, concluding it looks like a server implementation issue.
Did this work for you?What @fatsandfreedom tried on GitHub (Worked)
A commenter posted a
safe_call_toolwrapper that catchesValidationError, readse.errors()[0]['input']['toolResult'], and returns it as a dict so the client can continue processing the result.Did this work for you?What @jspahrsummers tried on GitHub (Outcome unclear)
A maintainer said they believe PR #176 in modelcontextprotocol/servers fixes the issue and asked the reporters to confirm; no confirmation appears in the thread.
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema