update_task
Modify task status, title, description, or priority within a project to track progress and maintain accurate project information.
Instructions
Update task status or details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| taskId | Yes | Task ID | |
| status | No | New task status | |
| title | No | New task title | |
| description | No | New task description | |
| priority | No | New task priority |
Implementation Reference
- src/server.ts:243-275 (handler)The handler function for the 'update_task' tool. It calls contextManager.updateTask with the provided parameters and returns a success or error message.async ({ projectId, taskId, status, title, description, priority }) => { try { const updatedTask = await this.contextManager.updateTask( projectId, taskId, { ...(status && { status }), ...(title && { title }), ...(description && { description }), ...(priority && { priority }), } ); return { content: [ { type: "text", text: `Task "${updatedTask.title}" updated successfully`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error updating task: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }
- src/server.ts:226-242 (schema)The input schema definition for the 'update_task' tool, specifying parameters and Zod validation rules.title: "Update Task", description: "Update task status or details", inputSchema: { projectId: z.string().describe("Project ID"), taskId: z.string().describe("Task ID"), status: z .enum(["todo", "in-progress", "blocked", "completed"]) .optional() .describe("New task status"), title: z.string().optional().describe("New task title"), description: z.string().optional().describe("New task description"), priority: z .enum(["low", "medium", "high", "critical"]) .optional() .describe("New task priority"), }, },
- src/server.ts:223-276 (registration)The registration of the 'update_task' tool using this.server.registerTool, including schema and inline handler.this.server.registerTool( "update_task", { title: "Update Task", description: "Update task status or details", inputSchema: { projectId: z.string().describe("Project ID"), taskId: z.string().describe("Task ID"), status: z .enum(["todo", "in-progress", "blocked", "completed"]) .optional() .describe("New task status"), title: z.string().optional().describe("New task title"), description: z.string().optional().describe("New task description"), priority: z .enum(["low", "medium", "high", "critical"]) .optional() .describe("New task priority"), }, }, async ({ projectId, taskId, status, title, description, priority }) => { try { const updatedTask = await this.contextManager.updateTask( projectId, taskId, { ...(status && { status }), ...(title && { title }), ...(description && { description }), ...(priority && { priority }), } ); return { content: [ { type: "text", text: `Task "${updatedTask.title}" updated successfully`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error updating task: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } } );
- Helper method in ContextManager that performs the actual task update logic: locates the task, merges updates, handles special fields like completedAt, and persists to the project store.async updateTask( projectId: string, taskId: string, updates: Partial<Task> ): Promise<Task> { const project = await this.store.getProject(projectId); if (!project) { throw new Error("Project not found"); } const taskIndex = project.tasks.findIndex((t) => t.id === taskId); if (taskIndex === -1) { throw new Error("Task not found"); } const updatedTask = { ...project.tasks[taskIndex], ...updates, updatedAt: new Date().toISOString(), }; if (updates.status === "completed" && !updatedTask.completedAt) { updatedTask.completedAt = new Date().toISOString(); } project.tasks[taskIndex] = updatedTask; await this.store.updateProject(project); return updatedTask; }