clear-completed-tasks
Remove all completed tasks from a Google Tasks list to maintain organization and focus on pending items.
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 Google Tasks API, handles errors.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)Zod input schema defining the 'tasklist' parameter as a string.{ tasklist: z.string().describe("Task list ID"), },
- src/index.ts:922-967 (registration)Registration of the 'clear-completed-tasks' tool on the MCP server with name, description, schema, and handler.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}`, }, ], }; } } );