Skip to main content
Glama

google_tasks_update_task

Modify task details in Google Tasks, including title, notes, due date, status, or task list, by providing the task ID. Ensures accurate updates for task management.

Instructions

Update an existing task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dueNoNew due date in RFC 3339 format
notesNoNew notes or description for the task
statusNoNew status for the task (needsAction or completed)
taskIdYesID of the task to update
taskListIdNoID of the task list the task belongs to (uses default if not specified)
titleNoNew title for the task

Implementation Reference

  • The handler function that validates the input arguments using isUpdateTaskArgs and calls the GoogleTasks.updateTask method to perform the update.
    export async function handleTasksUpdateTask( args: any, googleTasksInstance: GoogleTasks ) { if (!isUpdateTaskArgs(args)) { throw new Error("Invalid arguments for google_tasks_update_task"); } const { taskId, title, notes, due, status, taskListId } = args; const result = await googleTasksInstance.updateTask( taskId, { title, notes, due, status }, taskListId ); return { content: [{ type: "text", text: result }], isError: false, }; }
  • The MCP tool schema defining the name, description, and input schema for google_tasks_update_task.
    export const UPDATE_TASK_TOOL: Tool = { name: "google_tasks_update_task", description: "Update an existing task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to update", }, title: { type: "string", description: "New title for the task", }, notes: { type: "string", description: "New notes or description for the task", }, due: { type: "string", description: "New due date in RFC 3339 format", }, status: { type: "string", description: "New status for the task (needsAction or completed)", }, taskListId: { type: "string", description: "ID of the task list the task belongs to (uses default if not specified)", }, }, required: ["taskId"], }, };
  • The dispatch case in the main tool call handler that routes google_tasks_update_task calls to the tasks handler.
    case "google_tasks_update_task": return await tasksHandlers.handleTasksUpdateTask( args, googleTasksInstance );
  • Type guard (schema validation helper) used in the handler to validate arguments for google_tasks_update_task.
    export function isUpdateTaskArgs(args: any): args is { taskId: string; title?: string; notes?: string; due?: string; status?: string; taskListId?: string; } { return ( args && typeof args.taskId === "string" && (args.title === undefined || typeof args.title === "string") && (args.notes === undefined || typeof args.notes === "string") && (args.due === undefined || typeof args.due === "string") && (args.status === undefined || typeof args.status === "string") && (args.taskListId === undefined || typeof args.taskListId === "string") ); }
  • The core Google Tasks API implementation for updating a task, called by the handler. Fetches current task, merges updates, and performs the API patch.
    async updateTask( taskId: string, data: { title?: string; notes?: string; due?: string; status?: string; }, taskListId?: string ) { try { const targetTaskList = taskListId || this.defaultTaskList; // Get current task data const currentTask = await this.tasks.tasks.get({ tasklist: targetTaskList, task: taskId, }); // Prepare updated task data const updatedTask = { ...currentTask.data }; if (data.title !== undefined) updatedTask.title = data.title; if (data.notes !== undefined) updatedTask.notes = data.notes; if (data.due !== undefined) updatedTask.due = data.due; if (data.status !== undefined) updatedTask.status = data.status; const response = await this.tasks.tasks.update({ tasklist: targetTaskList, task: taskId, requestBody: updatedTask, }); return `Task updated: "${response.data.title}" with ID: ${response.data.id}`; } catch (error) { throw new Error( `Failed to update task: ${ error instanceof Error ? error.message : String(error) }` ); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vakharwalad23/google-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server