Skip to main content
Glama

set_long_term_memory

Store user profiles including demographics, contact information, and preferences to enable personalized AI interactions through persistent memory management.

Instructions

Store user demographics, contact details, or preferences

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactNoContact information
demographicsNoUser demographics (age, location, occupation, etc.)
preferencesNoUser preferences and settings
userIdYesUser identifier

Implementation Reference

  • Registration of the set_long_term_memory tool, including its name, description, and input schema definition.
    { name: "set_long_term_memory", description: "Store user demographics, contact details, or preferences", inputSchema: { type: "object", properties: { userId: { type: "string", description: "User identifier" }, demographics: { type: "object", description: "User demographics (age, location, occupation, etc.)" }, contact: { type: "object", description: "Contact information" }, preferences: { type: "object", description: "User preferences and settings" } }, required: ["userId"] } },
  • The MCP tool handler that processes the set_long_term_memory call: extracts arguments, validates userId, calls MemoryStore.setLongTermMemory, and returns a success response.
    case "set_long_term_memory": { const { userId, demographics, contact, preferences } = request.params.arguments as any; // Validate inputs ValidationUtils.validateUserId(userId); memoryStore.setLongTermMemory(userId, { demographics, contact, preferences }); return { content: [{ type: "text", text: `Updated long-term memory for user ${userId}` }] }; }
  • Core helper method that merges new long-term memory data with existing, updates the in-memory map, and persists to JSON file.
    setLongTermMemory(userId: string, data: Partial<LongTermMemory>): void { const existing = this.longTermMemory.get(userId) || { userId, lastUpdated: Date.now() }; const updated = { ...existing, ...data, lastUpdated: Date.now() }; this.longTermMemory.set(userId, updated); this.persistLongTermMemory(); }

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