Skip to main content
Glama

get_memory_context

Retrieve creation and update context for specific long-term memories to understand their origin and modification history.

Instructions

Get the creation and update context of a specific long-term memory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • The main handler logic for the 'get_memory_context' tool. It retrieves the specified long-term memory and returns its metadata, contexts, and formatted context.
    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 }; } }
  • Zod input schema defining the parameters for the tool: required 'name' and optional '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') }),
  • The complete tool definition object returned by createLongTermTools, which includes name, description, schema, and handler. This is registered dynamically in src/index.js.
    { name: 'get_memory_context', description: 'Get the creation and update context of a specific long-term memory.', inputSchema: z.object({ name: z.string().describe('Name of the memory'), conversation_id: z.string().optional().describe('Conversation ID that owns this memory') }), 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/index.js:157-158 (registration)
    Initial registration of long-term tools (including get_memory_context) for the default conversation using registerTool.
    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 for specific conversation_id.
    } 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`);

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/win10ogod/memory-mcp-server'

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