clear-completed-tasks
Remove all completed tasks from a specified task list in Google Tasks to maintain an organized and clutter-free workspace.
Instructions
Clear all completed tasks from a task list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasklist | Yes | Task list ID |
Implementation Reference
- src/index.ts:928-966 (handler)Handler function that implements the clear-completed-tasks tool logic: authenticates, clears completed tasks via tasks.tasks.clear, returns success or error response.async ({ tasklist }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { await tasks.tasks.clear({ tasklist, }); return { content: [ { type: "text", text: `All completed tasks in list '${tasklist}' have been cleared.`, }, ], }; } catch (error) { console.error("Error clearing completed tasks:", error); return { isError: true, content: [ { type: "text", text: `Error clearing completed tasks: ${error}`, }, ], }; } }
- src/index.ts:925-927 (schema)Input schema for the tool using Zod: requires 'tasklist' string.{ tasklist: z.string().describe("Task list ID"), },
- src/index.ts:922-967 (registration)Registration of the 'clear-completed-tasks' tool with server.tool, specifying name, description, input schema, and handler function.server.tool( "clear-completed-tasks", "Clear all completed tasks from a task list", { tasklist: z.string().describe("Task list ID"), }, async ({ tasklist }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { await tasks.tasks.clear({ tasklist, }); return { content: [ { type: "text", text: `All completed tasks in list '${tasklist}' have been cleared.`, }, ], }; } catch (error) { console.error("Error clearing completed tasks:", error); return { isError: true, content: [ { type: "text", text: `Error clearing completed tasks: ${error}`, }, ], }; } } );