Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesName of the memory
conversation_idNoConversation ID that owns this memory

Implementation Reference

  • 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
        };
      }
    }
  • 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`);

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