Skip to main content
Glama

get_long_term_memory

Retrieve persistent user profiles and preferences to maintain personalized AI interactions across sessions.

Instructions

Retrieve long-term memory for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesUser identifier

Implementation Reference

  • The main handler logic for the 'get_long_term_memory' tool. It validates the userId argument, retrieves the long-term memory using memoryStore, and returns it as a JSON-formatted text response.
    case "get_long_term_memory": { const { userId } = request.params.arguments as any; // Validate inputs ValidationUtils.validateUserId(userId); const memory = memoryStore.getLongTermMemory(userId); return { content: [{ type: "text", text: JSON.stringify(memory, null, 2) }] }; }
  • The tool registration entry in the ListTools handler, including name, description, and input schema specification.
    { name: "get_long_term_memory", description: "Retrieve long-term memory for a user", inputSchema: { type: "object", properties: { userId: { type: "string", description: "User identifier" } }, required: ["userId"] } },
  • The input schema defining the expected arguments for the 'get_long_term_memory' tool: a required userId string.
    inputSchema: { type: "object", properties: { userId: { type: "string", description: "User identifier" } }, required: ["userId"] }
  • The core helper method in MemoryStore that retrieves the long-term memory data for a user from the internal Map.
    getLongTermMemory(userId: string): LongTermMemory | null { return this.longTermMemory.get(userId) || 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/cbuntingde/memory-mcp-server'

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