Skip to main content
Glama
mstfe

Google Tasks MCP Server

by mstfe

complete_task

Mark tasks as completed or return to pending status in Google Tasks to track progress and manage workflow.

Instructions

Toggle the completion status of a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesID of the task to toggle completion status
statusNoStatus of task, needsAction or completed

Implementation Reference

  • Handler for the 'complete_task' tool: Validates arguments, extracts taskId and status, patches the task status via Google Tasks API, and returns the updated task data.
    if (request.params.name === "complete_task") { if (!isValidCreateTaskArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, "Invalid arguments for creating a task. 'title' must be a string, and 'notes' must be a string or undefined." ); } const args = request.params.arguments; const taskId = args.taskId; const newStatus = args.status; if (!taskId) { throw new McpError( ErrorCode.InvalidParams, "The 'taskId' field is required." ); } try { // Durumu güncelle const updateResponse = await tasks.tasks.patch({ tasklist: "@default", task: taskId, requestBody: { status: newStatus }, }); return { content: [ { type: "text", text: JSON.stringify(updateResponse.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Tasks API error: ${error}` ); } }
  • src/index.ts:173-184 (registration)
    Tool registration in the list_tools response, defining name, description, and input schema for 'complete_task'.
    { name: "complete_task", description: "Toggle the completion status of a task", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "ID of the task to toggle completion status" }, status: { type: "string", description: "Status of task, needsAction or completed" }, }, required: ["taskId"], }, },
  • Helper validation function used in the complete_task handler to check arguments (though originally for create_task).
    export function isValidCreateTaskArgs(args: any): args is CreateTaskArgs { return ( typeof args === "object" && args !== null && (args.title === undefined || typeof args.title === "string") && (args.notes === undefined || typeof args.notes === "string") && (args.taskId === undefined || typeof args.taskId === "string") && (args.status === undefined || typeof args.status === "string") ); }

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/mstfe/mcp-google-tasks'

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