handoff_clear
Clear specific or all conversation handoffs to manage transferred context between AI chats and projects, removing stored conversation histories.
Instructions
Clear handoffs. If key is provided, clears only that handoff. Otherwise clears all.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Optional: specific handoff key to clear |
Implementation Reference
- src/index.ts:459-497 (handler)Main tool handler for handoff_clear. Executes audit logging, calls storage.clear() with optional key, and formats success/error response messages with count of cleared items.async ({ key }) => { const audit = getAuditLogger(); const timer = audit.startTimer(); const { storage } = await getStorage(); const result = await storage.clear(key); audit.logTool({ event: "tool_call", toolName: "handoff_clear", durationMs: timer.elapsed(), success: result.success, error: result.error, }); if (!result.success) { return { content: [ { type: "text", text: `❌ ${result.error}`, }, ], }; } const message = key ? `✅ ${result.data?.message}` : `✅ ${result.data?.message} (${result.data?.count} items)`; return { content: [ { type: "text", text: message, }, ], }; }
- src/index.ts:453-458 (registration)Tool registration for handoff_clear. Defines tool name, description, and input schema using zod (optional 'key' parameter).server.tool( "handoff_clear", "Clear handoffs. If key is provided, clears only that handoff. Otherwise clears all.", { key: z.string().optional().describe("Optional: specific handoff key to clear"), },
- src/storage.ts:263-275 (helper)LocalStorage.clear() method implementation. Deletes a specific handoff if key provided, or clears all handoffs from the Map. Returns success message with optional count of cleared items.async clear(key?: string): Promise<StorageResult<{ message: string; count?: number }>> { if (key) { if (this.handoffs.has(key)) { this.handoffs.delete(key); return { success: true, data: { message: `Handoff cleared: "${key}"` } }; } return { success: false, error: `Handoff not found: "${key}"` }; } const count = this.handoffs.size; this.handoffs.clear(); return { success: true, data: { message: "All handoffs cleared", count } }; }
- src/storage.ts:647-652 (helper)RemoteStorage.clear() method implementation. Sends HTTP DELETE requests to server - either to /handoff/{key} for specific handoff or /handoff for all handoffs.async clear(key?: string): Promise<StorageResult<{ message: string; count?: number }>> { if (key) { return this.request("DELETE", `/handoff/${encodeURIComponent(key)}`); } return this.request("DELETE", "/handoff"); }