Skip to main content
Glama

delete_memory

Remove specific stored data from memory by specifying its key to manage information retention in AI systems.

Instructions

forget|delete|remove|erase - Delete specific memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesMemory key to delete

Implementation Reference

  • Main handler function for delete_memory tool. Uses MemoryManager to delete the specified memory key and returns a ToolResult with appropriate success or failure message.
    export async function deleteMemory(args: { key: string }): Promise<ToolResult> {
      const { key: deleteKey } = args;
    
      try {
        const mm = MemoryManager.getInstance();
        const deleted = mm.delete(deleteKey);
    
        if (deleted) {
          return {
            content: [{ type: 'text', text: `✓ Deleted memory: "${deleteKey}"` }]
          };
        } else {
          return {
            content: [{ type: 'text', text: `✗ Memory not found: "${deleteKey}"` }]
          };
        }
      } catch (error) {
        return {
          content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }]
        };
      }
    }
  • ToolDefinition object defining the schema for the delete_memory tool, including input schema requiring a 'key' string parameter.
    export const deleteMemoryDefinition: ToolDefinition = {
      name: 'delete_memory',
      description: 'forget|delete|remove|erase - Delete specific memory',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: 'Memory key to delete' }
        },
        required: ['key']
      },
      annotations: {
        title: 'Delete Memory',
        audience: ['user', 'assistant']
      }
    };
  • src/index.ts:124-135 (registration)
    Registration of deleteMemoryDefinition in the main tools array, which is served via the ListTools MCP handler with pagination support.
    // Memory Management Tools
    saveMemoryDefinition,
    recallMemoryDefinition,
    listMemoriesDefinition,
    deleteMemoryDefinition,
    searchMemoriesDefinition,
    updateMemoryDefinition,
    autoSaveContextDefinition,
    restoreSessionContextDefinition,
    prioritizeMemoryDefinition,
    startSessionDefinition,
  • src/index.ts:642-643 (registration)
    Dispatch registration in the central tool switch statement within executeToolCall, mapping 'delete_memory' calls to the deleteMemory handler.
    case 'delete_memory':
      return await deleteMemory(args as any) as CallToolResult;

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/ssdeanx/ssd-ai'

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