add_tasks_to_request
Extend an existing request by adding new tasks, enabling task expansion and progress tracking through a displayed table for all 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:497-527 (handler)The core handler function that adds new tasks to an existing request. It generates unique task IDs, appends the tasks to the request's task list, resets the request completion status, persists the data, and returns a formatted 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 structure for the tool: a requestId (string) and an array of tasks, each with title and description (strings). Used for validation in both registration and dispatch.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 entry in the listTools() method, providing the tool's name, description, and input schema to the MCP server.{ name: "add_tasks_to_request", description: "Add new tasks to an existing request.", inputSchema: AddTasksToRequestSchema, },
- index.ts:261-267 (handler)Dispatch handler in the callTool switch statement that validates input 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); }