mark_task_done
Mark a specific task as completed by providing 'requestId' and 'taskId'; optionally include 'completedDetails'. Displays an updated progress table and requires task approval via 'approve_task_completion' before proceeding further.
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 |
Implementation Reference
- index.ts:454-484 (handler)The core handler function in TaskManagerServer that executes the logic for marking a task as done: loads data, finds the task, sets done=true and completedDetails, saves to file, returns status.public async markTaskDone( requestId: string, taskId: string, completedDetails?: string ) { await this.loadTasks(); const req = this.data.requests.find((r) => r.requestId === 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.", }; task.done = true; task.completedDetails = completedDetails || ""; await this.saveTasks(); return { status: "task_marked_done", requestId: req.requestId, task: { id: task.id, title: task.title, description: task.description, completedDetails: task.completedDetails, approved: task.approved, }, }; }
- index.ts:732-746 (handler)The MCP server request handler (switch case) for 'mark_task_done': parses input arguments using the schema, calls the core markTaskDone method, and formats the response.case "mark_task_done": { const parsed = MarkTaskDoneSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const { requestId, taskId, completedDetails } = parsed.data; const result = await taskManagerServer.markTaskDone( requestId, taskId, completedDetails ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- index.ts:56-60 (schema)Zod schema for validating input parameters of the mark_task_done tool: requestId, taskId, optional completedDetails.const MarkTaskDoneSchema = z.object({ requestId: z.string(), taskId: z.string(), completedDetails: z.string().optional(), });
- index.ts:154-169 (registration)Tool object definition for 'mark_task_done', including name, description, and inputSchema. This is used for registration.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 this completed task using 'approve_task_completion'.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, completedDetails: { type: "string" }, }, required: ["requestId", "taskId"], }, };
- index.ts:687-687 (registration)Inclusion of MARK_TASK_DONE_TOOL in the list of tools returned by listTools handler.MARK_TASK_DONE_TOOL,