delete_task
Remove uncompleted tasks from a request to streamline task management. View a progress table to track remaining tasks after deletion, ensuring efficient workflow organization.
Instructions
Delete a specific task from a request. Only uncompleted tasks can be deleted.
A progress table will be displayed showing the remaining tasks after deletion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| taskId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"requestId": {
"type": "string"
},
"taskId": {
"type": "string"
}
},
"required": [
"requestId",
"taskId"
],
"type": "object"
}
Implementation Reference
- src/tools/TaskFlowTools.ts:595-598 (handler)MCP tool handler function that extracts requestId and taskId from args and delegates to TaskFlowService.deleteTask method.async delete_task(args: any) { const { requestId, taskId } = args ?? {}; return service.deleteTask(String(requestId), String(taskId)); },
- JSON Schema defining the input parameters for the delete_task tool: requestId and taskId as required strings.delete_task: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, }, required: ["requestId", "taskId"], },
- src/server/TaskFlowServer.ts:72-72 (registration)DELETE_TASK_TOOL constant is included in the array of tools provided by the listTools request handler.DELETE_TASK_TOOL,
- Core service method implementing the deletion logic: loads data, finds and validates the task, removes it from the request's tasks array, saves changes, and returns updated progress table.public async deleteTask(requestId: string, taskId: string) { await this.loadTasks(); const req = this.getRequest(requestId); if (!req) return { status: "error", message: "Request not found" }; const taskIndex = req.tasks.findIndex((t) => t.id === taskId); if (taskIndex === -1) return { status: "error", message: "Task not found" }; if (req.tasks[taskIndex].done) return { status: "error", message: "Cannot delete completed task" }; req.tasks.splice(taskIndex, 1); await this.saveTasks(); const progressTable = formatTaskProgressTableForRequest(req); return { status: "task_deleted", message: `Task ${taskId} has been deleted.\n${progressTable}` }; }