mark_task_done
Mark a specific task as completed by providing 'requestId' and 'taskId'. Optionally add 'completedDetails' for context. Displays updated task progress and requires user approval before proceeding.
Instructions
Mark a given task as done after you've completed it. Provide 'requestId' and 'taskId', and optionally 'completedDetails'.
After marking a task as done, a progress table will be displayed showing the updated status of all tasks.
After this, DO NOT proceed to 'get_next_task' again until the user has explicitly approved this completed task using 'approve_task_completion'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| completedDetails | No | ||
| requestId | Yes | ||
| taskId | Yes |
Input Schema (JSON Schema)
Implementation Reference
- src/tools/TaskFlowTools.ts:572-575 (handler)MCP tool handler that parses input arguments and delegates to the TaskFlowService's markTaskDone method.async mark_task_done(args: any) { const { requestId, taskId, completedDetails } = args ?? {}; return service.markTaskDone(String(requestId), String(taskId), completedDetails); },
- Core implementation of task completion: validates preconditions (subtasks done), marks task as done, persists to file, generates progress table response.public async markTaskDone(requestId: string, taskId: string, completedDetails?: string) { await this.loadTasks(); const req = this.getRequest(requestId); if (!req) return { status: "error", message: "Request not found" }; const task = req.tasks.find((t) => t.id === taskId); if (!task) return { status: "error", message: "Task not found" }; if (task.done) return { status: "already_done", message: "Task is already marked done." }; const hasSubtasks = task.subtasks.length > 0; const allSubtasksDone = task.subtasks.every((s) => s.done); if (hasSubtasks && !allSubtasksDone) { return { status: "subtasks_pending", message: "Cannot mark task as done until all subtasks are completed.", pendingSubtasks: task.subtasks.filter((s) => !s.done).map((s) => ({ id: s.id, title: s.title })), }; } task.done = true; task.completedDetails = completedDetails || ""; await this.saveTasks(); const progressTable = formatTaskProgressTableForRequest(req); return { status: "task_marked_done", requestId: req.requestId, task: { id: task.id, title: task.title, description: task.description, completedDetails: task.completedDetails, subtasks: task.subtasks.map((s) => ({ id: s.id, title: s.title, description: s.description, done: s.done, })), }, message: `Task ${taskId} has been marked as done.\n${progressTable}`, }; }
- JSON Schema defining the input parameters for the mark_task_done tool (requestId, taskId required; completedDetails optional).mark_task_done: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, completedDetails: { type: "string" }, }, required: ["requestId", "taskId"], },
- src/tools/TaskFlowTools.ts:115-130 (registration)Tool object definition with name, description, and inputSchema, exported and included in server registration for listTools.export const MARK_TASK_DONE_TOOL: Tool = { name: "mark_task_done", description: "Mark a given task as done after you've completed it. Provide 'requestId' and 'taskId', and optionally 'completedDetails'.\n\n" + "After marking a task as done, a progress table will be displayed showing the updated status of all tasks.\n\n" + "After this, DO NOT proceed to 'get_next_task' again until the user has explicitly approved the completed task. Ask the user for approval before continuing.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, completedDetails: { type: "string" }, }, required: ["requestId", "taskId"], }, };
- src/server/TaskFlowServer.ts:63-90 (registration)Server's listTools handler registers MARK_TASK_DONE_TOOL in the tools array provided to MCP clients.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ PLAN_TASK_TOOL, GET_NEXT_TASK_TOOL, MARK_TASK_DONE_TOOL, OPEN_TASK_DETAILS_TOOL, LIST_REQUESTS_TOOL, ADD_TASKS_TO_REQUEST_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, ADD_SUBTASKS_TOOL, MARK_SUBTASK_DONE_TOOL, UPDATE_SUBTASK_TOOL, DELETE_SUBTASK_TOOL, EXPORT_TASK_STATUS_TOOL, ADD_NOTE_TOOL, UPDATE_NOTE_TOOL, DELETE_NOTE_TOOL, ADD_DEPENDENCY_TOOL, GET_PROMPTS_TOOL, SET_PROMPTS_TOOL, UPDATE_PROMPTS_TOOL, REMOVE_PROMPTS_TOOL, ARCHIVE_COMPLETED_REQUESTS_TOOL, LIST_ARCHIVED_REQUESTS_TOOL, RESTORE_ARCHIVED_REQUEST_TOOL, ], }));