Skip to main content
Glama

google_tasks_complete_task

Mark a specific task as completed in Google Tasks by providing its task ID and optional task list ID to manage tasks efficiently.

Instructions

Mark a task as completed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesID of the task to complete
taskListIdNoID of the task list the task belongs to (uses default if not specified)

Implementation Reference

  • The primary handler function that validates input arguments using isCompleteTaskArgs and calls the GoogleTasks.completeTask method to mark the task as completed.
    export async function handleTasksCompleteTask( args: any, googleTasksInstance: GoogleTasks ) { if (!isCompleteTaskArgs(args)) { throw new Error("Invalid arguments for google_tasks_complete_task"); } const { taskId, taskListId } = args; const result = await googleTasksInstance.completeTask(taskId, taskListId); return { content: [{ type: "text", text: result }], isError: false, }; }
  • Defines the tool's metadata, description, and input schema specifying required taskId and optional taskListId.
    export const COMPLETE_TASK_TOOL: Tool = { name: "google_tasks_complete_task", description: "Mark a task as completed", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to complete", }, taskListId: { type: "string", description: "ID of the task list the task belongs to (uses default if not specified)", }, }, required: ["taskId"], }, };
  • Dispatches calls to 'google_tasks_complete_task' to the corresponding handler function within the MCP server's CallToolRequest handler.
    case "google_tasks_complete_task": return await tasksHandlers.handleTasksCompleteTask( args, googleTasksInstance );
  • Type guard for validating input arguments match the expected shape: required taskId (string) and optional taskListId (string).
    export function isCompleteTaskArgs(args: any): args is { taskId: string; taskListId?: string; } { return ( args && typeof args.taskId === "string" && (args.taskListId === undefined || typeof args.taskListId === "string") ); }
  • Core implementation in GoogleTasks class that marks a task as completed by calling updateTask with status 'completed', using Google Tasks API.
    async completeTask(taskId: string, taskListId?: string) { try { const targetTaskList = taskListId || this.defaultTaskList; await this.updateTask(taskId, { status: "completed" }, targetTaskList); return `Task ${taskId} marked as completed.`; } catch (error) { throw new Error( `Failed to complete 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