delete_long_term_memory
Remove specific long-term memory entries by name to manage stored information in memory management systems.
Instructions
Delete a long-term memory by name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the memory to delete | |
| conversation_id | No | Conversation ID that owns this memory |
Implementation Reference
- src/tools/long-term-tools.js:132-155 (handler)The handler function for the 'delete_long_term_memory' MCP tool. It calls the LongTermMemoryManager's deleteMemory method, persists changes via storage, and returns appropriate success/error responses.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 for validating the tool's arguments: required 'name' and optional 'conversation_id'.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/index.js:157-158 (registration)Registration of the long-term tools array (including delete_long_term_memory) into the MCP server's tool registry for default conversation.const longTermTools = createLongTermTools(defaultLongTermManager, defaultStorageManager); longTermTools.forEach(tool => registerTool(tool, 'long-term'));
- src/memory/long-term.js:249-253 (helper)Supporting deleteMemory method in LongTermMemoryManager class that removes the specified memory from the internal array and returns deletion success status.deleteMemory(name) { const initialLength = this.memories.length; this.memories = this.memories.filter(mem => mem.name !== name); return this.memories.length < initialLength; }
- src/index.js:291-295 (registration)Dynamic recreation and execution of long-term tools during tool calls, ensuring conversation-specific managers are used.manager = await getLongTermManager(conversationId); storage = getStorageManager(conversationId); const tools = createLongTermTools(manager, storage); const tool = tools.find(t => t.name === toolName); result = await withTimeout(tool.handler(validatedArgs), timeout, `Tool ${toolName} timeout`);