get_memory_history
Retrieve the history of changes for a specific memory by providing its UUID. This tool supports persistent memory continuity in AI systems, enabling tracking of modifications over time.
Instructions
Get change history for a specific memory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memory_id | Yes | UUID of the memory |
Implementation Reference
- src/memory-manager.js:931-944 (handler)Core handler function that retrieves the change history for a given memory ID by querying the memoryChanges table, ordered by most recent changes first.async getMemoryHistory(memoryId) { try { const history = await this.db .select() .from(schema.memoryChanges) .where(eq(schema.memoryChanges.memoryId, memoryId)) .orderBy(desc(schema.memoryChanges.changedAt)); return history; } catch (error) { console.warn('Memory history query failed:', error.message); return []; } }
- mcp.js:674-676 (registration)MCP server tool call dispatcher (switch case) that handles 'get_memory_history' requests by calling the underlying memoryManager.getMemoryHistory and formatting the response.case "get_memory_history": const memoryHistory = await memoryManager.getMemoryHistory(args.memory_id); return { content: [{ type: "text", text: JSON.stringify(memoryHistory, null, 2) }] };
- src/tools/memory-tools.js:432-445 (schema)Tool schema definition exported from memory-tools.js, specifying the input requirements (memory_id) for the get_memory_history tool.{ name: "get_memory_history", description: "Get change history for a specific memory", inputSchema: { type: "object", properties: { memory_id: { type: "string", description: "UUID of the memory" } }, required: ["memory_id"] } },
- mcp.js:458-471 (schema)Tool schema included in the MCP listTools response for get_memory_history.{ name: "get_memory_history", description: "Get change history for a specific memory", inputSchema: { type: "object", properties: { memory_id: { type: "string", description: "UUID of the memory" } }, required: ["memory_id"] } },
- src/memory-manager.js:946-962 (helper)Supporting helper function that inserts change records into the memoryChanges table, which are later queried by getMemoryHistory.async trackMemoryChange(memoryId, changeType, description, metadata = {}) { try { const [change] = await this.db .insert(schema.memoryChanges) .values({ memoryId, changeType, newValue: { description, metadata } }) .returning(); return change; } catch (error) { console.warn('Memory change tracking failed:', error.message); return null; } }