complete_task
Update the completion status of a Google Task by providing the task ID and setting it to 'needsAction' or 'completed' for task management.
Instructions
Toggle the completion status of a task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Status of task, needsAction or completed | |
| taskId | Yes | ID of the task to toggle completion status |
Implementation Reference
- src/index.ts:282-323 (handler)Handler for the 'complete_task' tool. Validates arguments, extracts taskId and status, then patches the task status using the Google Tasks API.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)Registration of the 'complete_task' tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.{ 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"], }, },