delete_long_term_memory
Remove specific long-term memories by name to manage stored information and maintain relevant data in memory systems.
Instructions
Delete a long-term memory by name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools/long-term-tools.js:132-155 (handler)The main handler function for the 'delete_long_term_memory' tool. Receives arguments, calls LongTermMemoryManager.deleteMemory, persists via storageManager.saveLongTermMemories, and returns formatted success/error response.handler: async (args) => { try { const success = memoryManager.deleteMemory(args.name); if (success) { await storageManager.saveLongTermMemories(memoryManager.getMemories()); return { success: true, message: `Memory "${args.name}" deleted successfully`, remainingMemories: memoryManager.getMemories().length }; } else { return { success: false, message: `Memory "${args.name}" not found` }; } } catch (error) { return { success: false, error: error.message }; } }
- src/tools/long-term-tools.js:128-131 (schema)Zod input schema defining parameters: 'name' (required string) and 'conversation_id' (optional string).inputSchema: z.object({ name: z.string().describe('Name of the memory to delete'), conversation_id: z.string().optional().describe('Conversation ID that owns this memory') }),
- src/memory/long-term.js:249-253 (helper)Core deletion logic in LongTermMemoryManager class: filters memories array by name and returns boolean success.deleteMemory(name) { const initialLength = this.memories.length; this.memories = this.memories.filter(mem => mem.name !== name); return this.memories.length < initialLength; }
- src/index.js:293-295 (registration)Dynamic registration and invocation: recreates long-term tools for specific conversation_id and calls the matching tool handler during MCP call_tool requests.const tools = createLongTermTools(manager, storage); const tool = tools.find(t => t.name === toolName); result = await withTimeout(tool.handler(validatedArgs), timeout, `Tool ${toolName} timeout`);