You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am encountering a validation error when interacting with the MCP Memory Server using the create_entities tool. The error indicates that the response from the Memory Server is missing the required content field.
The issue arises when calling the create_entities tool through a Python client. Despite the Memory Server returning what seems to be a valid response, the client throws a validation error, stating that the content field is missing.
Error Output
Here’s the error output from my debug script:
Knowledge Graph MCP Server running on stdio
Error calling Memory Server: 1 validation error for CallToolResult
content
Field required [type=missing, input_value={'toolResult': [{'name': ... ['Test observation']}]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing
Steps to Reproduce
Run the following Python debug script to test the create_entities tool:
importasynciofrommcpimportClientSession, StdioServerParametersfrommcp.client.stdioimportstdio_clientasyncdeftest_memory_server():
server_params=StdioServerParameters(
command="npx",
args=[
"-y",
"@modelcontextprotocol/server-memory"
]
)
asyncwithstdio_client(server_params) as (read, write):
asyncwithClientSession(read, write) assession:
awaitsession.initialize()
# Example call to create_entitiescommand="create_entities"parameters= {
"entities": [
{
"name": "Test_Entity",
"entityType": "person",
"observations": ["Test observation"]
}
]
}
try:
result=awaitsession.call_tool(command, parameters)
print(f"Memory Server result for '{command}': {result}")
exceptExceptionase:
print(f"Error calling Memory Server: {e}")
asyncio.run(test_memory_server())
Observe the error output described above.
What I Expected
I expected the create_entities tool to return a successful response with the following structure:
I also have this issue for memory & puppeteer servers, but not with Brave server. So, it seems server implementation issue?
If successful, my personal AI is capable of calling the tool & reacting to the tool response. But for both memory & puppeteer servers, it stops right after invoking the tool.
I also have this issue for memory & puppeteer servers, but not with Brave server. So, it seems server implementation issue?
If successful, my personal AI is capable of calling the tool & reacting to the tool response. But for both memory & puppeteer servers, it stops right after invoking the tool.
In memory server, I used a workaround to address this issue.
asyncdefsafe_call_tool(session, command, parameters):
"""Safely call an MCP tool and handle validation errors."""try:
result=awaitsession.call_tool(command, parameters)
returnresultexceptValidationErrorase:
# Extract the actual tool result from the validation errorraw_data=e.errors() ifhasattr(e, 'errors') elseNoneifraw_dataandlen(raw_data) >0:
tool_result=raw_data[0]['input']['toolResult']
return {"toolResult": tool_result}
# Re-raise the exception if the result cannot be extractedraise
Description
Hello, I am encountering a validation error when interacting with the MCP Memory Server using the create_entities tool. The error indicates that the response from the Memory Server is missing the required content field.
The issue arises when calling the create_entities tool through a Python client. Despite the Memory Server returning what seems to be a valid response, the client throws a validation error, stating that the content field is missing.
Error Output
Here’s the error output from my debug script:
Steps to Reproduce
What I Expected
I expected the create_entities tool to return a successful response with the following structure:
What I Observed
The actual response from the Memory Server was missing the content field. Instead, it returned:
This mismatch causes the client to throw a validation error.
Environment
Python Version: 3.10
Operating System: Ubuntu 20.04
The text was updated successfully, but these errors were encountered: