list-tasks
Retrieve all tasks from a Google Tasks list, with options to filter by completion status, visibility, and deletion state.
Instructions
List all tasks in a task list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasklist | Yes | Task list ID | |
| showCompleted | No | Whether to include completed tasks | |
| showHidden | No | Whether to include hidden tasks | |
| showDeleted | No | Whether to include deleted tasks |
Implementation Reference
- src/index.ts:452-539 (handler)Full implementation of the 'list-tasks' tool handler, including input schema, registration, and execution logic using Google Tasks API to list tasks with optional filters.server.tool( "list-tasks", "List all tasks in a task list", { tasklist: z.string().describe("Task list ID"), showCompleted: z .boolean() .optional() .describe("Whether to include completed tasks"), showHidden: z .boolean() .optional() .describe("Whether to include hidden tasks"), showDeleted: z .boolean() .optional() .describe("Whether to include deleted tasks"), }, async ({ tasklist, showCompleted = true, showHidden = false, showDeleted = false, }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response: any = await tasks.tasks.list({ tasklist, showCompleted, showHidden, showDeleted, }); const tasksResponse = response.data.items || []; if (tasksResponse.length === 0) { return { content: [ { type: "text", text: "No tasks found in this list.", }, ], }; } const formattedTasks = tasksResponse.map((task: any) => ({ id: task.id, title: task.title, status: task.status, due: task.due, notes: task.notes, completed: task.completed, })); return { content: [ { type: "text", text: JSON.stringify(formattedTasks, null, 2), }, ], }; } catch (error) { console.error("Error listing tasks:", error); return { isError: true, content: [ { type: "text", text: `Error listing tasks: ${error}`, }, ], }; } } );