Skip to main content
Glama

forget_memory

Permanently delete a specific memory by its key to remove outdated or incorrect information from long-term storage.

Instructions

Permanently delete a specific memory by key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe memory key to delete

Implementation Reference

  • The handler for the 'forget_memory' tool. It extracts the 'key' argument, validates it, calls store.remove(key), and returns an OK message indicating whether the memory was deleted or not found.
    // ── forget_memory ──────────────────────────────────────────────────────
    case 'forget_memory': {
      const key = String(a['key'] ?? '').trim();
      if (!key) return err('key is required');
      const deleted = store.remove(key);
      return ok(deleted ? `Memory deleted: "${key}"` : `Memory not found: "${key}"`);
    }
  • The tool registration and input schema definition for 'forget_memory'. It defines the tool name, description, and inputSchema requiring a 'key' string parameter.
    {
      name: 'forget_memory',
      description: 'Permanently delete a specific memory by key.',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: 'The memory key to delete' },
        },
        required: ['key'],
      },
    },
  • src/index.ts:23-150 (registration)
    The forget_memory tool is registered via the ListToolsRequestSchema handler (line 23-150), which lists all available tools. It is also registered in the CallToolRequestSchema switch statement (lines 292-298) where the actual dispatch happens.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'store_memory',
          description:
            'Store a new memory — fact, preference, project detail, note, or any information worth remembering. ' +
            'Tags and importance are auto-detected from content if not provided.',
          inputSchema: {
            type: 'object',
            properties: {
              key: {
                type: 'string',
                description: 'Unique snake_case identifier (e.g. "user_name", "preferred_language", "project_deadline")',
              },
              content: {
                type: 'string',
                description: 'The memory content — be descriptive and specific for better retrieval',
              },
              tags: {
                type: 'array',
                items: { type: 'string' },
                description: 'Categorization tags (auto-detected if omitted)',
              },
              importance: {
                type: 'number',
                description: 'Importance score 1-10 — higher = retrieved first (auto-scored if omitted)',
              },
            },
            required: ['key', 'content'],
          },
        },
        {
          name: 'search_memory',
          description:
            'Search memories using BM25 full-text search with importance and recency weighting. ' +
            'Supports optional tag filtering to narrow scope.',
          inputSchema: {
            type: 'object',
            properties: {
              query: { type: 'string', description: 'Search query — natural language or keywords' },
              limit: { type: 'number', description: 'Max results to return (default: 5)' },
              tags: {
                type: 'array',
                items: { type: 'string' },
                description: 'Only search memories with these tags',
              },
            },
            required: ['query'],
          },
        },
        {
          name: 'get_relevant_context',
          description:
            'Auto-retrieve the most relevant memories for a given user query or task. ' +
            'Use this at the start of any session or when the user references past context. ' +
            'Returns formatted context ready to inject into your reasoning.',
          inputSchema: {
            type: 'object',
            properties: {
              user_query: {
                type: 'string',
                description: 'The current user query, task description, or topic to find context for',
              },
            },
            required: ['user_query'],
          },
        },
        {
          name: 'update_memory',
          description: 'Update the content, tags, or importance of an existing memory by key.',
          inputSchema: {
            type: 'object',
            properties: {
              key: { type: 'string', description: 'The memory key to update' },
              new_content: { type: 'string', description: 'Replacement content (omit to keep existing)' },
              tags: {
                type: 'array',
                items: { type: 'string' },
                description: 'New tag list — replaces existing tags',
              },
              importance: { type: 'number', description: 'New importance score 1-10' },
            },
            required: ['key'],
          },
        },
        {
          name: 'list_memories',
          description: 'Browse stored memories with optional tag filtering and sort order.',
          inputSchema: {
            type: 'object',
            properties: {
              tags: {
                type: 'array',
                items: { type: 'string' },
                description: 'Filter to only memories with these tags',
              },
              limit: { type: 'number', description: 'Max results (default: 20)' },
              sort: {
                type: 'string',
                enum: ['recent', 'importance', 'access'],
                description: 'Sort by: recent (default), importance, or access count',
              },
            },
          },
        },
        {
          name: 'forget_memory',
          description: 'Permanently delete a specific memory by key.',
          inputSchema: {
            type: 'object',
            properties: {
              key: { type: 'string', description: 'The memory key to delete' },
            },
            required: ['key'],
          },
        },
        {
          name: 'memory_summary',
          description:
            'Get a high-level overview of what the agent knows — total count, top tags, ' +
            'most important memories, and access statistics. Good for orientation at session start.',
          inputSchema: {
            type: 'object',
            properties: {},
          },
        },
      ],
    }));
  • The store.remove() method called by the forget_memory handler. It filters out the memory by key, persists to disk if removed, and returns true if a memory was deleted or false if not found.
    remove(key: string): boolean {
      const before = this.data.memories.length;
      this.data.memories = this.data.memories.filter(m => m.key !== key);
      if (this.data.memories.length !== before) {
        this.persist();
        return true;
      }
      return false;
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses the irreversible nature of the action ('permanently delete'), which is valuable. However, it does not mention side effects, permissions required, or error handling, leaving gaps.

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

Conciseness5/5

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

The description is a single, clear sentence with no redundant or extraneous information. It efficiently conveys the essential purpose.

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

Completeness4/5

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

Given the simplicity of the tool (one parameter, no output schema), the description is fairly complete. It covers the action and irreversibility. However, it could add information about success/failure behavior or preconditions, but the minimal context is acceptable for a straightforward delete operation.

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?

The input schema already provides a description for the 'key' parameter ('The memory key to delete'). The tool description adds only the context 'by key', which does not significantly enhance understanding beyond the schema. With 100% schema coverage, baseline is 3.

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

Purpose5/5

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

The description clearly states the action ('permanently delete'), the resource ('specific memory'), and the identifier ('by key'). It distinctly differentiates from sibling tools like store_memory, update_memory, and list_memories.

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 explicit guidance on when to use this tool versus alternatives, such as update_memory or search_memory. The only clue is the tool's name and the word 'delete', which is minimal.

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/AIsofialuz/agent-memory-hub'

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