update_task_status
Update the completion status of tasks within structured coding workflows, ensuring accurate progress tracking and phased development management in the Vibe-Coder MCP Server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| completed | Yes | ||
| featureId | Yes | ||
| phaseId | Yes | ||
| taskId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"completed": {
"type": "boolean"
},
"featureId": {
"minLength": 1,
"type": "string"
},
"phaseId": {
"minLength": 1,
"type": "string"
},
"taskId": {
"minLength": 1,
"type": "string"
}
},
"required": [
"featureId",
"phaseId",
"taskId",
"completed"
],
"type": "object"
}
Implementation Reference
- src/tool-handlers.ts:389-436 (handler)The primary MCP tool handler for 'update_task_status'. It validates input using Zod schema, checks feature/phase/task existence, invokes the core updateTaskStatus helper, provides feedback on task status and phase completion, and handles errors.const updateTaskStatusHandler: ToolHandler<z.infer<typeof UpdateTaskStatusSchema>> = async (params) => { try { const { featureId, phaseId, taskId, completed } = UpdateTaskStatusSchema.parse(params); // Validate feature, phase and task const validationResult = validateFeaturePhaseTask(featureId, phaseId, taskId); if (!validationResult.valid) { return createToolErrorResponse(validationResult.message); } const { feature, phase, task } = validationResult.data; // Update the task status const updatedTask = updateTaskStatus(featureId, phaseId, taskId, completed); // Check if all tasks in this phase are now completed if (completed && phase.tasks.every((t: Task) => t.id === taskId || t.completed)) { // Auto-advance the phase to 'completed' status return { content: [{ type: "text", text: `Task marked as ${completed ? 'completed' : 'incomplete'}. All tasks in this phase are now complete. The phase "${phase.name}" has been automatically marked as completed.` }] }; } // Check if all tasks are completed and suggest phase update if applicable let message = `Task status updated to ${completed ? 'completed' : 'not completed'}`; if (completed && phase.tasks.every((t: Task) => t.id === taskId || t.completed)) { // All tasks are now completed message += `. All tasks in phase ${phase.name} are now completed. Consider updating the phase status to 'completed'.`; } return { content: [{ type: "text", text: message }] }; } catch (error) { if (error instanceof z.ZodError) { const errorMessage = error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return createToolErrorResponse(`Validation error: ${errorMessage}`); } return createToolErrorResponse(error instanceof Error ? error.message : "Unknown error"); } };
- src/tool-handlers.ts:379-384 (schema)Zod schema used for input validation in the updateTaskStatusHandler.const UpdateTaskStatusSchema = z.object({ featureId: z.string().min(1), phaseId: z.string().min(1), taskId: z.string().min(1), completed: z.boolean() });
- src/tool-handlers.ts:719-759 (registration)Registers the 'update_task_status' tool with the tool registry, specifying the handler, JSON schema parameters, description, and usage examples.toolRegistry.register( 'update_task_status', updateTaskStatusHandler, 'Update the completion status of a task', { type: 'object', properties: { featureId: { type: 'string', description: 'ID of the feature containing the phase' }, phaseId: { type: 'string', description: 'ID of the phase containing the task' }, taskId: { type: 'string', description: 'ID of the task to update' }, completed: { type: 'boolean', description: 'Whether the task is completed' } }, required: ['featureId', 'phaseId', 'taskId', 'completed'] }, [ { featureId: "feature-123", phaseId: "phase-456", taskId: "task-789", completed: true }, { featureId: "feature-123", phaseId: "phase-456", taskId: "task-789", completed: false } ] );
- src/phases.ts:156-187 (helper)Core utility function that locates the task within the feature's phases and updates its completion status by mutating the feature object and persisting via updateFeature.export function updateTaskStatus( featureId: string, phaseId: string, taskId: string, completed: boolean ): Feature | undefined { const feature = getFeature(featureId); if (!feature) return undefined; const phaseIndex = feature.phases.findIndex(p => p.id === phaseId); if (phaseIndex === -1) return undefined; const taskIndex = feature.phases[phaseIndex].tasks.findIndex(t => t.id === taskId); if (taskIndex === -1) return undefined; const updatedPhases = [...feature.phases]; const updatedTasks = [...updatedPhases[phaseIndex].tasks]; updatedTasks[taskIndex] = { ...updatedTasks[taskIndex], completed, updatedAt: now() }; updatedPhases[phaseIndex] = { ...updatedPhases[phaseIndex], tasks: updatedTasks, updatedAt: now() }; return updateFeature(featureId, { phases: updatedPhases }); }