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
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | User identifier |
Implementation Reference
- src/handlers/ToolHandlers.ts:243-256 (handler)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) }] }; }
- src/handlers/ToolHandlers.ts:92-105 (registration)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"] } },
- src/handlers/ToolHandlers.ts:95-104 (schema)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"] }
- src/store/MemoryStore.ts:139-141 (helper)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; }