clear_completed
Remove all completed tasks to declutter your task list and focus on active items.
Instructions
Remove all completed tasks
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "clear_completed"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:421-444 (handler)The main handler function that executes the clear_completed tool logic: loads tasks, filters out completed tasks, saves the updated storage, and returns a formatted message indicating the number of tasks cleared.
export async function clearCompleted() { const storage = await loadTasks(); const originalCount = storage.tasks.length; // Filter out completed tasks storage.tasks = storage.tasks.filter((t) => t.status !== "completed"); const removedCount = originalCount - storage.tasks.length; await saveTasks(storage); const message = removedCount > 0 ? `🧹 Cleared ${removedCount} completed task(s). ${storage.tasks.length} active task(s) remaining.` : "No completed tasks to clear."; return { content: [ { type: "text", text: message, }, ], }; } - src/index.ts:179-186 (registration)Tool registration in the TOOLS array used for ListTools response, defining name, description, and input schema (empty object since no parameters required).
{ name: "clear_completed", description: "Remove all completed tasks", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:236-237 (registration)Switch case in the CallToolRequestHandler that routes requests for 'clear_completed' to the clearCompleted handler function.
case "clear_completed": return await clearCompleted(); - src/index.ts:182-185 (schema)Input schema definition for the clear_completed tool, specifying an empty object since the tool takes no arguments.
inputSchema: { type: "object", properties: {}, },