delete_subtask
Remove an uncompleted subtask from a task in TaskFlow MCP by providing requestId, taskId, and subtaskId. View the updated task progress with remaining subtasks.
Instructions
Delete a subtask from a task. Provide 'requestId', 'taskId', and 'subtaskId'.
Only uncompleted subtasks can be deleted.
A progress table will be displayed showing the updated task with its remaining subtasks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| subtaskId | Yes | ||
| taskId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"requestId": {
"type": "string"
},
"subtaskId": {
"type": "string"
},
"taskId": {
"type": "string"
}
},
"required": [
"requestId",
"taskId",
"subtaskId"
],
"type": "object"
}
Implementation Reference
- src/tools/TaskFlowTools.ts:615-618 (handler)MCP tool handler function. Extracts arguments (requestId, taskId, subtaskId) from input and delegates to TaskFlowService.deleteSubtask method.async delete_subtask(args: any) { const { requestId, taskId, subtaskId } = args ?? {}; return service.deleteSubtask(String(requestId), String(taskId), String(subtaskId)); },
- src/tools/TaskFlowTools.ts:299-314 (schema)Tool definition with name, description, and inputSchema (JSON Schema) for parameter validation in MCP.export const DELETE_SUBTASK_TOOL: Tool = { name: "delete_subtask", description: "Delete a subtask from a task. Provide 'requestId', 'taskId', and 'subtaskId'.\n\n" + "Only uncompleted subtasks can be deleted.\n\n" + "A progress table will be displayed showing the updated task with its remaining subtasks.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, subtaskId: { type: "string" }, }, required: ["requestId", "taskId", "subtaskId"], }, };
- src/server/TaskFlowServer.ts:63-90 (registration)Tool registration via ListToolsRequestSchema handler. DELETE_SUBTASK_TOOL is included in the tools array returned 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, ], }));
- Core business logic. Locates the subtask by IDs, checks if uncompleted, removes it from the task's subtasks array, persists changes to file, generates progress table, returns success status.public async deleteSubtask(requestId: string, taskId: string, subtaskId: 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" }; const subtaskIndex = task.subtasks.findIndex((s) => s.id === subtaskId); if (subtaskIndex === -1) return { status: "error", message: "Subtask not found" }; if (task.subtasks[subtaskIndex].done) return { status: "error", message: "Cannot delete completed subtask" }; task.subtasks.splice(subtaskIndex, 1); await this.saveTasks(); const progressTable = formatTaskProgressTableForRequest(req); return { status: "subtask_deleted", message: `Subtask ${subtaskId} has been deleted.\n${progressTable}` }; }