google_tasks_get_task
Retrieve specific task details by providing the task ID and optional task list ID from Google Tasks. Integrates with Google MCP for AI client compatibility.
Instructions
Get details about a specific task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taskId | Yes | ID of the task to retrieve | |
| taskListId | No | ID of the task list the task belongs to (uses default if not specified) |
Implementation Reference
- handlers/tasks.ts:59-72 (handler)Main handler function for 'google_tasks_get_task' tool. Validates input arguments, extracts taskId and taskListId, calls the GoogleTasks instance's getTask method, and formats the response.export async function handleTasksGetTask( args: any, googleTasksInstance: GoogleTasks ) { if (!isGetTaskArgs(args)) { throw new Error("Invalid arguments for google_tasks_get_task"); } const { taskId, taskListId } = args; const result = await googleTasksInstance.getTask(taskId, taskListId); return { content: [{ type: "text", text: result }], isError: false, }; }
- tools/tasks/index.ts:46-64 (schema)Tool definition including name, description, and inputSchema for 'google_tasks_get_task'.export const GET_TASK_TOOL: Tool = { name: "google_tasks_get_task", description: "Get details about a specific task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to retrieve", }, taskListId: { type: "string", description: "ID of the task list the task belongs to (uses default if not specified)", }, }, required: ["taskId"], }, };
- server-setup.ts:228-232 (registration)Registration in the switch statement that dispatches tool calls to the specific handler function.case "google_tasks_get_task": return await tasksHandlers.handleTasksGetTask( args, googleTasksInstance );
- utils/helper.ts:339-348 (helper)Type guard function used for input validation in the handler (isGetTaskArgs).export function isGetTaskArgs(args: any): args is { taskId: string; taskListId?: string; } { return ( args && typeof args.taskId === "string" && (args.taskListId === undefined || typeof args.taskListId === "string") ); }
- utils/tasks.ts:79-107 (helper)Core implementation in GoogleTasks class: fetches the task using Google API, formats the output with title, ID, status, due date, completion date, and notes.async getTask(taskId: string, taskListId?: string) { try { const targetTaskList = taskListId || this.defaultTaskList; const response = await this.tasks.tasks.get({ tasklist: targetTaskList, task: taskId, }); const task = response.data; const due = task.due ? `Due: ${new Date(task.due).toLocaleString()}` : ""; const completed = task.completed ? `Completed: ${new Date(task.completed).toLocaleString()}` : ""; const status = task.status || ""; return `Task: ${task.title} ID: ${task.id} Status: ${status} ${due} ${completed} ${task.notes ? `Notes: ${task.notes}` : ""}`; } catch (error) { throw new Error( `Failed to get task: ${ error instanceof Error ? error.message : String(error) }` ); } }