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();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states what gets stored but doesn't disclose whether this creates new records or updates existing ones, what permissions are required, whether data persists permanently, or what happens on success/failure. For a data storage tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for a simple storage operation, though it could be more front-loaded with critical behavioral information given the lack of annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a data storage tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after storage (success response, error conditions), whether this overwrites existing data, or how it differs from sibling storage tools. The context demands more completeness for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description mentions the same three data categories (demographics, contact, preferences) but adds no additional meaning beyond what the schema provides. The baseline of 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool stores user data (demographics, contact details, preferences), which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like 'set_short_term_memory' or 'add_episodic_memory' - the purpose is clear but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'set_short_term_memory' and 'get_long_term_memory', there's no indication of when this long-term storage is appropriate versus short-term or when to retrieve versus store data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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