Skip to main content
Glama

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
NameRequiredDescriptionDefault
memory_idYesUUID of the memory

Implementation Reference

  • 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) }] };
  • 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"] } },
  • 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"] } },
  • 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; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/QuixiAI/agi-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server