--- title: 'MCP Tool Reference' description: 'Complete reference for all 7 memory operation tools' --- # MCP Tool Reference The T6 Mem0 v2 MCP server provides 7 tools for complete memory lifecycle management. All tools use JSON-RPC 2.0 protocol and support both HTTP/SSE and stdio transports. ## add_memory Store new memories extracted from conversation messages. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `messages` | Array | Yes | Array of message objects with `role` and `content` | | `user_id` | String | No | User identifier for memory association | | `agent_id` | String | No | Agent identifier for memory association | | `metadata` | Object | No | Additional metadata to store with memories | ### Example Request ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "add_memory", "arguments": { "messages": [ {"role": "user", "content": "I love Python programming"}, {"role": "assistant", "content": "Great! I'll remember that."} ], "user_id": "user_123", "metadata": {"source": "chat", "session_id": "abc-123"} } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 1, "result": { "content": [ { "type": "text", "text": "Added 1 memories for user user_123" } ] } } ``` ## search_memories Search memories using semantic similarity matching. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `query` | String | Yes | Search query text | | `user_id` | String | No | Filter by user ID | | `agent_id` | String | No | Filter by agent ID | | `limit` | Integer | No | Maximum results (default: 10, max: 50) | ### Example Request ```json { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "search_memories", "arguments": { "query": "What programming languages does the user like?", "user_id": "user_123", "limit": 5 } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 2, "result": { "content": [ { "type": "text", "text": "Found 2 memories:\n1. ID: mem_abc123 - User loves Python programming (score: 0.92)\n2. ID: mem_def456 - User interested in JavaScript (score: 0.78)" } ] } } ``` ## get_memory Retrieve a specific memory by its ID. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `memory_id` | String | Yes | Unique memory identifier | ### Example Request ```json { "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "get_memory", "arguments": { "memory_id": "mem_abc123" } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "Memory: User loves Python programming\nCreated: 2025-10-15T10:30:00Z\nUser: user_123" } ] } } ``` ## get_all_memories Retrieve all memories for a specific user or agent. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `user_id` | String | No* | User identifier | | `agent_id` | String | No* | Agent identifier | *At least one of `user_id` or `agent_id` must be provided. ### Example Request ```json { "jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": { "name": "get_all_memories", "arguments": { "user_id": "user_123" } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 4, "result": { "content": [ { "type": "text", "text": "Found 3 memories for user user_123:\n1. User loves Python programming\n2. User interested in JavaScript\n3. User works as software engineer" } ] } } ``` ## update_memory Update the content of an existing memory. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `memory_id` | String | Yes | Unique memory identifier | | `data` | String | Yes | New memory content | ### Example Request ```json { "jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": { "name": "update_memory", "arguments": { "memory_id": "mem_abc123", "data": "User is an expert Python developer" } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 5, "result": { "content": [ { "type": "text", "text": "Memory mem_abc123 updated successfully" } ] } } ``` ## delete_memory Delete a specific memory by ID. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `memory_id` | String | Yes | Unique memory identifier | ### Example Request ```json { "jsonrpc": "2.0", "id": 6, "method": "tools/call", "params": { "name": "delete_memory", "arguments": { "memory_id": "mem_abc123" } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 6, "result": { "content": [ { "type": "text", "text": "Memory mem_abc123 deleted successfully from both vector and graph stores" } ] } } ``` ## delete_all_memories Delete all memories for a specific user or agent. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `user_id` | String | No* | User identifier | | `agent_id` | String | No* | Agent identifier | *At least one of `user_id` or `agent_id` must be provided. This operation is irreversible. All memories for the specified user/agent will be permanently deleted from both Supabase (vector store) and Neo4j (graph store). ### Example Request ```json { "jsonrpc": "2.0", "id": 7, "method": "tools/call", "params": { "name": "delete_all_memories", "arguments": { "user_id": "user_123" } } } ``` ### Example Response ```json { "jsonrpc": "2.0", "id": 7, "result": { "content": [ { "type": "text", "text": "Deleted 3 memories for user user_123" } ] } } ``` ## Error Responses All tools return standardized error responses: ```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32603, "message": "Internal error: Memory not found", "data": { "type": "MemoryNotFoundError", "details": "No memory exists with ID mem_xyz789" } } } ``` ### Common Error Codes | Code | Description | |------|-------------| | `-32700` | Parse error - Invalid JSON | | `-32600` | Invalid request - Missing required fields | | `-32601` | Method not found - Unknown tool name | | `-32602` | Invalid params - Invalid arguments | | `-32603` | Internal error - Server-side error | ## Synchronized Operations All delete operations (both `delete_memory` and `delete_all_memories`) are synchronized across both storage backends: - **Supabase (Vector Store)**: Removes embeddings and memory records - **Neo4j (Graph Store)**: Removes nodes and relationships This ensures data consistency across the entire memory system. ## Next Steps Use MCP tools in n8n workflows Integrate with Claude Code