add_tasks_to_request
Extend existing requests by adding new tasks to them, then view all tasks including the newly added ones in a progress table.
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:497-527 (handler)The core handler function that implements the logic for adding new tasks to an existing request. It finds the request, generates new task IDs, adds the tasks, resets completion status, saves data, and returns a progress table.public async addTasksToRequest( requestId: string, tasks: { title: string; description: string }[] ) { const request = this.data.requests.find((r) => r.requestId === requestId); if (!request) { throw new Error("Request not found"); } const newTasks: Task[] = tasks.map((t) => { this.taskCounter++; return { id: `task-${this.taskCounter}`, title: t.title, description: t.description, done: false, approved: false, completedDetails: "", }; }); request.tasks.push(...newTasks); request.completed = false; // Reset completion since new tasks were added await this.saveTasks(); return { message: "Tasks added to request.\n" + this.formatTaskProgressTable(requestId), }; }
- index.ts:68-76 (schema)Zod schema defining the input parameters for the add_tasks_to_request tool: requestId (string) and tasks array of {title, description}.const AddTasksToRequestSchema = z.object({ requestId: z.string(), tasks: z.array( z.object({ title: z.string(), description: z.string(), }) ), });
- index.ts:180-184 (registration)Tool registration object returned by listTools() method, specifying name, description, and input schema.{ name: "add_tasks_to_request", description: "Add new tasks to an existing request.", inputSchema: AddTasksToRequestSchema, },
- index.ts:261-267 (handler)Dispatch handler in callTool() switch statement that parses input parameters using the schema and delegates to the main addTasksToRequest method.case "add_tasks_to_request": { const parsed = AddTasksToRequestSchema.safeParse(parameters); if (!parsed.success) { throw new Error(`Invalid parameters: ${parsed.error}`); } return this.addTasksToRequest(parsed.data.requestId, parsed.data.tasks); }