update_task
Modify the title or description of uncompleted tasks in the MCP TaskManager system. Input task ID and new details to display updated progress.
Instructions
Update an existing task's title and/or description. Only uncompleted tasks can be updated.
A progress table will be displayed showing the updated task information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| requestId | Yes | ||
| taskId | Yes | ||
| title | No |
Implementation Reference
- index.ts:529-561 (handler)The primary handler function for the update_task tool. It locates the specified request and task, validates that the task is not done or approved, applies the provided title and/or description updates, persists the changes, and returns a success message with the updated task progress table.public async updateTask( requestId: string, taskId: string, updates: { title?: string; description?: string } ) { const request = this.data.requests.find((r) => r.requestId === requestId); if (!request) { throw new Error("Request not found"); } const task = request.tasks.find((t) => t.id === taskId); if (!task) { throw new Error("Task not found"); } if (task.done || task.approved) { throw new Error("Cannot update completed or approved tasks"); } if (updates.title) { task.title = updates.title; } if (updates.description) { task.description = updates.description; } await this.saveTasks(); return { message: "Task updated successfully.\n" + this.formatTaskProgressTable(requestId), }; }
- index.ts:78-83 (schema)Zod input schema for the update_task tool, defining required requestId and taskId, with optional title and description fields.const UpdateTaskSchema = z.object({ requestId: z.string(), taskId: z.string(), title: z.string().optional(), description: z.string().optional(), });
- index.ts:185-189 (registration)Tool registration in the listTools() method, specifying the name, description, and input schema for update_task.{ name: "update_task", description: "Update an existing task.", inputSchema: UpdateTaskSchema, },
- index.ts:268-277 (handler)Dispatch handler in the callTool method that parses input parameters using the schema and delegates to the updateTask method.case "update_task": { const parsed = UpdateTaskSchema.safeParse(parameters); if (!parsed.success) { throw new Error(`Invalid parameters: ${parsed.error}`); } return this.updateTask(parsed.data.requestId, parsed.data.taskId, { title: parsed.data.title, description: parsed.data.description, }); }