update_memory
Modify existing stored information by replacing the text of a specific memory entry to maintain accurate and current data.
Instructions
Overwrite an existing memory’s text.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"memory_id": "<memory_id>",
"text": "<text>"
},
"name": "update_memory"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memory_id | Yes | Exact memory_id to overwrite. | |
| text | Yes | Replacement text for the memory. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mem0_mcp_server/server.py:390-400 (handler)The main handler function for the 'update_memory' tool. It is decorated with @server.tool, which registers it with the FastMCP server. The function calls the Mem0 client's update method to overwrite the memory text given a memory_id.
@server.tool(description="Overwrite an existing memory’s text.") def update_memory( memory_id: Annotated[str, Field(description="Exact memory_id to overwrite.")], text: Annotated[str, Field(description="Replacement text for the memory.")], ctx: Context | None = None, ) -> str: """Overwrite an existing memory’s text after the user confirms the exact memory_id.""" api_key, _, _ = _resolve_settings(ctx) client = _mem0_client(api_key) return _mem0_call(client.update, memory_id=memory_id, text=text)