delete_memory
Remove outdated or incorrect memories by providing the memory ID. Keeps stored context accurate and relevant.
Instructions
Delete a memory by ID. Use when a memory is outdated, incorrect, or no longer relevant.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The memory ID to delete |
Implementation Reference
- src/tools/delete.ts:1-31 (handler)The registerDeleteMemory function defines the 'delete_memory' MCP tool. It accepts an 'id' string, calls storage.delete(id), and returns a JSON response indicating success or memory-not-found.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { RekindleStorage } from "../storage/sqlite.js"; export function registerDeleteMemory( server: McpServer, storage: RekindleStorage ): void { server.tool( "delete_memory", "Delete a memory by ID. Use when a memory is outdated, incorrect, or no longer relevant.", { id: z.string().describe("The memory ID to delete"), }, async ({ id }) => { const deleted = storage.delete(id); return { content: [ { type: "text" as const, text: JSON.stringify({ success: deleted, message: deleted ? "Memory deleted" : "Memory not found", }), }, ], }; } ); - src/tools/delete.ts:12-13 (schema)The input schema for 'delete_memory' tool: requires a single 'id' field of type string with a description 'The memory ID to delete'.
{ id: z.string().describe("The memory ID to delete"), - src/server.ts:7-21 (registration)Import of registerDeleteMemory from './tools/delete.js' and registration call at line 21 where the tool is registered on the MCP server.
import { registerDeleteMemory } from "./tools/delete.js"; import { registerUpdateMemory } from "./tools/update.js"; import { registerBootReport } from "./tools/boot-report.js"; import { registerEndSession } from "./tools/end-session.js"; export function createServer(storage: RekindleStorage): McpServer { const server = new McpServer({ name: "rekindle", version: "0.2.0", }); registerStoreMemory(server, storage); registerSearchMemory(server, storage); registerListMemories(server, storage); registerDeleteMemory(server, storage); - src/storage/sqlite.ts:282-287 (helper)The storage.delete(id) method used by the 'delete_memory' handler. It executes a SQL DELETE FROM memories WHERE id = ? and returns true if any row was affected.
delete(id: string): boolean { const result = this.db .prepare(`DELETE FROM memories WHERE id = ?`) .run(id); return result.changes > 0; }