get_memory_context
Retrieve creation and update details for specific long-term memories to understand their context and evolution over time.
Instructions
Get the creation and update context of a specific long-term memory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the memory | |
| conversation_id | No | Conversation ID that owns this memory |
Implementation Reference
- src/tools/long-term-tools.js:234-261 (handler)The main handler function for the 'get_memory_context' tool. It retrieves the specified long-term memory using memoryManager.findMemoryByName and returns detailed context information including creation/update contexts and trigger.handler: async (args) => { try { const memory = memoryManager.findMemoryByName(args.name); if (!memory) { return { success: false, message: `Memory "${args.name}" not found` }; } return { success: true, name: memory.name, createdAt: memory.createdAt.toISOString(), updatedAt: memory.updatedAt?.toISOString(), createdContext: memory.createdContext || null, updatedContext: memory.updatedContext || null, formattedContext: memoryManager.formatMemoryContext(memory), trigger: memory.trigger }; } catch (error) { return { success: false, error: error.message }; } }
- src/tools/long-term-tools.js:230-233 (schema)Zod input schema for the 'get_memory_context' tool, requiring the memory 'name' and optionally 'conversation_id'.inputSchema: z.object({ name: z.string().describe('Name of the memory'), conversation_id: z.string().optional().describe('Conversation ID that owns this memory') }),
- src/index.js:156-158 (registration)Registration of the long-term tools, including 'get_memory_context', into the MCP server's tool registry during server initialization.// 注册所有长期记忆工具 const longTermTools = createLongTermTools(defaultLongTermManager, defaultStorageManager); longTermTools.forEach(tool => registerTool(tool, 'long-term'));
- src/index.js:290-295 (registration)Dynamic recreation and invocation of long-term tools (including 'get_memory_context') during tool call handling, using conversation-specific managers.} else if (toolScope === 'long-term' || toolName.includes('long_term')) { manager = await getLongTermManager(conversationId); storage = getStorageManager(conversationId); const tools = createLongTermTools(manager, storage); const tool = tools.find(t => t.name === toolName); result = await withTimeout(tool.handler(validatedArgs), timeout, `Tool ${toolName} timeout`);