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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Memory key to delete |
Implementation Reference
- src/tools/memory/deleteMemory.ts:22-43 (handler)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;