get_memory_history
Retrieve change history for a specific memory in the AGI MCP Server's persistent storage system to track modifications and maintain continuity.
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)The actual implementation of getMemoryHistory method that queries the memoryChanges table for all changes associated with a given memory ID, ordered by changedAt in descending order (most recent 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 []; } } - src/tools/memory-tools.js:433-445 (schema)Tool schema definition for get_memory_history, specifying the input validation with memory_id as required parameter.
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:674-676 (registration)Handler registration in the switch statement that calls memoryManager.getMemoryHistory and returns the results as JSON.
case "get_memory_history": const memoryHistory = await memoryManager.getMemoryHistory(args.memory_id); return { content: [{ type: "text", text: JSON.stringify(memoryHistory, null, 2) }] }; - mcp.js:459-470 (registration)Tool registration in the MCP server's ListTools handler, exposing get_memory_history to clients.
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/db/schema.js:181-194 (schema)Database schema for the memoryChanges table that stores change history records with changeId, memoryId, changedAt, changeType, oldValue, and newValue fields.
export const memoryChanges = pgTable("memory_changes", { changeId: uuid("change_id").defaultRandom().primaryKey().notNull(), memoryId: uuid("memory_id"), changedAt: timestamp("changed_at", { withTimezone: true, mode: 'string' }).default(sql`CURRENT_TIMESTAMP`), changeType: text("change_type").notNull(), oldValue: jsonb("old_value"), newValue: jsonb("new_value"), }, (table) => [ foreignKey({ columns: [table.memoryId], foreignColumns: [memories.id], name: "memory_changes_memory_id_fkey" }), ]);