get-task
Retrieve a specific task by its ID from a designated task list using the Google Tasks MCP Server, enabling efficient task management through the Claude interface.
Instructions
Get a specific task by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | Task ID | |
| tasklist | Yes | Task list ID |
Implementation Reference
- src/index.ts:549-588 (handler)The handler function for the 'get-task' tool. It checks if the user is authenticated, then retrieves the specific task from the Google Tasks API using the provided tasklist and task IDs, returning the task data as JSON or an error message.async ({ tasklist, task }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasks.get({ tasklist, task, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { console.error("Error getting task:", error); return { isError: true, content: [ { type: "text", text: `Error getting task: ${error}`, }, ], }; } }
- src/index.ts:545-548 (schema)Input schema for the 'get-task' tool using Zod validation for tasklist and task parameters.{ tasklist: z.string().describe("Task list ID"), task: z.string().describe("Task ID"), },
- src/index.ts:542-589 (registration)The registration of the 'get-task' tool on the MCP server, including name, description, input schema, and inline handler function.server.tool( "get-task", "Get a specific task by ID", { tasklist: z.string().describe("Task list ID"), task: z.string().describe("Task ID"), }, async ({ tasklist, task }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasks.get({ tasklist, task, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { console.error("Error getting task:", error); return { isError: true, content: [ { type: "text", text: `Error getting task: ${error}`, }, ], }; } } );