get-tasklist
Retrieve a specific task list by its ID using the Google Tasks MCP Server, enabling direct task management through the Claude interface.
Instructions
Get a task list by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasklist | Yes | Task list ID |
Implementation Reference
- src/index.ts:251-289 (handler)The handler function for the 'get-tasklist' tool. It checks if the user is authenticated, fetches the task list by ID using the Google Tasks API, returns the task list data as JSON, or an error message if authentication fails or API call fails.async ({ tasklist }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasklists.get({ tasklist, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { console.error("Error getting task list:", error); return { isError: true, content: [ { type: "text", text: `Error getting task list: ${error}`, }, ], }; } }
- src/index.ts:248-250 (schema)Input schema for the 'get-tasklist' tool using Zod, requiring a 'tasklist' parameter which is the ID of the task list to retrieve.{ tasklist: z.string().describe("Task list ID"), },
- src/index.ts:245-290 (registration)The server.tool registration call that registers the 'get-tasklist' tool with MCP server, including name, description, input schema, and handler function.server.tool( "get-tasklist", "Get a task list by ID", { 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 { const response = await tasks.tasklists.get({ tasklist, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { console.error("Error getting task list:", error); return { isError: true, content: [ { type: "text", text: `Error getting task list: ${error}`, }, ], }; } } );
- src/index.ts:47-49 (helper)Helper function used within the 'get-tasklist' handler to check if OAuth credentials are available (i.e., user is authenticated).function isAuthenticated() { return credentials !== null; }