update_task
Modify task details such as status, title, description, or priority on the MCP Project Context Server to maintain accurate project tracking and context across coding sessions.
Instructions
Update task status or details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | New task description | |
| priority | No | New task priority | |
| projectId | Yes | Project ID | |
| status | No | New task status | |
| taskId | Yes | Task ID | |
| title | No | New task title |
Implementation Reference
- src/server.ts:243-275 (handler)The MCP tool handler for 'update_task' that processes input, updates the task via ContextManager, and returns a formatted text response.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:229-242 (schema)Zod input schema defining parameters for the 'update_task' tool: projectId, taskId, optional status, title, description, priority.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)Registration of the 'update_task' tool with the MCP server, including name, metadata, schema, and handler reference.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" }`, }, ], }; } } );
- ContextManager.updateTask helper method that finds and updates the specified task in the project, handles completion timestamp, and persists changes.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; }