add_tasks_to_request
Extend existing requests by adding new tasks, subtasks, and dependencies. Displays an updated progress table for tracking all tasks within TaskFlow MCP.
Instructions
Add new tasks to an existing request. This allows extending a request with additional tasks.
Tasks can include subtasks and dependencies. A progress table will be displayed showing all tasks including the newly added ones.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| tasks | Yes |
Implementation Reference
- src/services/TaskFlowService.ts:358-385 (handler)Core handler that loads the task file, validates the request exists and is not completed, creates new tasks with unique IDs using TaskFactory, appends them to the request, saves the file, generates a progress table, and returns the result.public async addTasksToRequest( requestId: string, tasks: { title: string; description: string; subtasks?: { title: string; description: string }[]; dependencies?: Dependency[]; }[] ) { await this.loadTasks(); const req = this.getRequest(requestId); if (!req) return { status: "error", message: "Request not found" }; if (req.completed) return { status: "error", message: "Cannot add tasks to completed request" }; const factory = new TaskFactory({ value: this.globalIdCounter }); const newTasks: Task[] = tasks.map((t) => factory.createTask(t)); this.globalIdCounter = factory["counterRef"].value; req.tasks.push(...newTasks); await this.saveTasks(); const progressTable = formatTaskProgressTableForRequest(req); return { status: "tasks_added", message: `Added ${newTasks.length} new tasks to request.\n${progressTable}`, newTasks: newTasks.map((t) => ({ id: t.id, title: t.title, description: t.description })), }; }
- src/tools/TaskFlowTools.ts:585-588 (handler)Thin wrapper handler in the taskflowHandlers dispatcher that extracts arguments and delegates to TaskFlowService.addTasksToRequest.async add_tasks_to_request(args: any) { const { requestId, tasks } = args ?? {}; return service.addTasksToRequest(String(requestId), tasks ?? []); },
- src/tools/TaskFlowTools.ts:155-202 (registration)Tool definition exporting the ADD_TASKS_TO_REQUEST_TOOL object with name, description, and input schema for registration.export const ADD_TASKS_TO_REQUEST_TOOL: Tool = { name: "add_tasks_to_request", description: "Add new tasks to an existing request. This allows extending a request with additional tasks.\n\n" + "Tasks can include subtasks and dependencies. A progress table will be displayed showing all tasks including the newly added ones.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, tasks: { type: "array", items: { type: "object", properties: { title: { type: "string" }, description: { type: "string" }, dependencies: { type: "array", items: { type: "object", properties: { name: { type: "string" }, version: { type: "string" }, url: { type: "string" }, description: { type: "string" }, }, required: ["name"], }, }, subtasks: { type: "array", items: { type: "object", properties: { title: { type: "string" }, description: { type: "string" }, }, required: ["title", "description"], }, }, }, required: ["title", "description"], }, }, }, required: ["requestId", "tasks"], }, };
- src/server/TaskFlowServer.ts:64-89 (registration)Registration of the tool in the MCP server's listTools handler response, making it available to clients.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, ],
- JSON schema definition for the tool's input validation in shared schemas.add_tasks_to_request: { type: "object", properties: { requestId: { type: "string" }, tasks: { type: "array", items: taskInputJson }, }, required: ["requestId", "tasks"], },