add_tasks_to_request
Extend existing requests by adding new tasks within the MCP task management system. Automatically updates the progress table to include new tasks.
Instructions
Add new tasks to an existing request. This allows extending a request with additional tasks.
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
- index.ts:576-615 (handler)Core handler function in TaskManagerServer that adds new tasks to an existing request, generates IDs, updates persistence, and provides progress feedback.public async addTasksToRequest( requestId: string, tasks: { title: string; description: string }[] ) { await this.loadTasks(); const req = this.data.requests.find((r) => r.requestId === requestId); if (!req) return { status: "error", message: "Request not found" }; if (req.completed) return { status: "error", message: "Cannot add tasks to completed request", }; const newTasks: Task[] = []; for (const taskDef of tasks) { this.taskCounter += 1; newTasks.push({ id: `task-${this.taskCounter}`, title: taskDef.title, description: taskDef.description, done: false, approved: false, completedDetails: "", }); } req.tasks.push(...newTasks); await this.saveTasks(); const progressTable = this.formatTaskProgressTable(requestId); 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, })), }; }
- index.ts:77-85 (schema)Zod schema for validating input to add_tasks_to_request tool.const AddTasksToRequestSchema = z.object({ requestId: z.string(), tasks: z.array( z.object({ title: z.string(), description: z.string(), }) ), });
- index.ts:225-248 (registration)Tool object definition registering the add_tasks_to_request tool with MCP, including name, description, and input schema.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" + "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" }, }, required: ["title", "description"], }, }, }, required: ["requestId", "tasks"], }, };
- index.ts:683-696 (registration)Registration of all tools including add_tasks_to_request in the MCP server's listTools handler.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ REQUEST_PLANNING_TOOL, GET_NEXT_TASK_TOOL, MARK_TASK_DONE_TOOL, APPROVE_TASK_COMPLETION_TOOL, APPROVE_REQUEST_COMPLETION_TOOL, OPEN_TASK_DETAILS_TOOL, LIST_REQUESTS_TOOL, ADD_TASKS_TO_REQUEST_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, ], }));
- index.ts:799-812 (handler)MCP server dispatcher case that validates input with schema and invokes the addTasksToRequest handler.case "add_tasks_to_request": { const parsed = AddTasksToRequestSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const { requestId, tasks } = parsed.data; const result = await taskManagerServer.addTasksToRequest( requestId, tasks ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }