add_tasks_to_request
Extend existing requests by adding new tasks with subtasks and dependencies, then view updated progress tables in 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/tools/TaskFlowTools.ts:585-588 (handler)MCP tool handler function that extracts arguments and delegates to TaskFlowService.addTasksToRequest method.async add_tasks_to_request(args: any) { const { requestId, tasks } = args ?? {}; return service.addTasksToRequest(String(requestId), tasks ?? []); },
- JSON Schema definition for the 'add_tasks_to_request' tool input validation, exported as part of jsonSchemas.add_tasks_to_request: { type: "object", properties: { requestId: { type: "string" }, tasks: { type: "array", items: taskInputJson }, }, required: ["requestId", "tasks"], },
- src/server/TaskFlowServer.ts:63-90 (registration)Registration of the tool in the MCP server's listTools handler, including ADD_TASKS_TO_REQUEST_TOOL in the tools array.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 service method that implements the logic to add new tasks to an existing request, including ID generation, persistence, and progress table generation.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:155-202 (schema)Tool object definition including name, description, and inputSchema for 'add_tasks_to_request'.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"], }, };