update_task
Modify an existing task by adding dependencies, uncertainty areas, and definitions of done to ensure clarity and progress tracking in the Task Manager MCP Server.
Instructions
A tool to update an existing task. Can optionally provide a list of additional dependencies, uncertainty areas, and definitions of done.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| newDefinitionsOfDone | No | A detailed list of additional criteria that must be met for this task to be considered complete. | |
| newDependsOnTaskIDs | Yes | A list of additional task identifiers this task depends on. | |
| newUncertaintyAreas | Yes | A detailed list of additional areas where there is uncertainty about this task's requirements or execution. May be empty. Ensure list is ordered by priority. | |
| taskID | Yes | The identifier of this task. |
Implementation Reference
- tools/index.ts:34-37 (registration)Registration of the 'update_task' tool, mapping the name UPDATE_TASK to its handler and schema in the toolHandlers function.[UPDATE_TASK]: { handler: handleUpdateTask, schema: UpdateTaskArgsSchema, } satisfies ToolHandlerInfo,
- tools/update_task.ts:91-113 (handler)The main handler function for the 'update_task' tool. It processes multiple task updates by delegating to handleUpdateSingleTask, computes remaining incomplete tasks, and returns structured results.export async function handleUpdateTask({ tasks }: UpdateTaskArgs, taskDB: TaskDB, singleAgent: boolean) { const updatedTasks = new Array<Task>() for (const taskUpdate of tasks) { const task = handleUpdateSingleTask(taskUpdate, taskDB) updatedTasks.push(task) } const taskID = tasks.map((t) => t.taskID)[0] const incompleteTaskIDs = taskDB.incompleteTasksInTree(taskID).map((t) => t.taskID) const res = { tasksUpdated: updatedTasks.map((t) => toBasicTaskInfo(t, false, t.status !== DoneStatus && t.status !== FailedStatus, t.status === TodoStatus) ), incompleteTasksIdealOrder: singleAgent ? incompleteTaskIDs : undefined, } return { content: [], structuredContent: res, } satisfies CallToolResult }
- tools/update_task.ts:115-229 (helper)Supporting helper function that implements the core logic for updating a single task, including status transitions with validations, setting properties, adding arrays, and removing dependencies.function handleUpdateSingleTask({ taskID, set, add, remove }: TaskUpdate, taskDB: TaskDB) { const task = taskDB.get(taskID) if (!task) { throw new Error(`Task not found: ${taskID}`) } if (set) { const { status: newStatus, title, description, goal, criticalPath, estimatedComplexity } = set const oldStatus = task.status const critPathDepsNotDone = task.dependsOnTaskIDs.filter((depTaskID) => { const depTask = taskDB.get(depTaskID)! return depTask.criticalPath && depTask.status !== 'done' }) const transitionValidations: Array<{ from?: TaskStatus; to: TaskStatus; validate: () => void }> = [ { from: DoneStatus, to: FailedStatus, validate() { throw new Error(`Can't transition from ${oldStatus} to ${newStatus}`) }, }, { from: FailedStatus, to: DoneStatus, validate() { throw new Error(`Can't transition from ${oldStatus} to ${newStatus}`) }, }, { to: DoneStatus, validate() { if (critPathDepsNotDone.length > 0) { throw new Error( `Can't transition task ${taskID} to ${newStatus}: Critical path dependencies are not ${DoneStatus}: ${critPathDepsNotDone.join( ', ' )}` ) } }, }, ] transitionValidations .filter((tv) => !tv.from || tv.from === oldStatus) .filter((tv) => tv.to === newStatus) .forEach((tv) => tv.validate()) if (newStatus) { task.status = newStatus } if (title) { task.title = title } if (description) { task.description = description } if (goal) { task.goal = goal } if (typeof criticalPath !== 'undefined') { task.criticalPath = criticalPath } if (estimatedComplexity) { task.estimatedComplexity = estimatedComplexity } } if (add) { const { definitionsOfDone: addDefinitionsOfDone, uncertaintyAreas: addUncertaintyAreas, lessonsLearned: addLessonsLearned, verificationEvidence: addVerificationEvidence, } = add if (addDefinitionsOfDone) { task.definitionsOfDone.push(...addDefinitionsOfDone) } if (addUncertaintyAreas) { task.uncertaintyAreas.push(...addUncertaintyAreas) } if (addLessonsLearned) { task.lessonsLearned.push(...addLessonsLearned) } if (addVerificationEvidence) { task.verificationEvidence.push(...addVerificationEvidence) } } if (remove) { const { dependsOnTaskIDs: removeDependsOnTaskIDs } = remove if (removeDependsOnTaskIDs) { task.dependsOnTaskIDs = task.dependsOnTaskIDs.filter((depTaskID) => !removeDependsOnTaskIDs.includes(depTaskID)) } } return task }
- tools/update_task.ts:73-75 (schema)Zod schema for the input arguments to the update_task tool, consisting of an array of task updates.export const UpdateTaskArgsSchema = z.object({ tasks: TaskUpdateSchema.array().min(1).describe('The tasks to update'), })
- tools/update_task.ts:23-69 (schema)Inner Zod schema defining the structure of a single task update, used by UpdateTaskArgsSchema. Includes set, add, and remove operations.const TaskUpdateSchema = z.object({ taskID: TaskIDSchema.describe('The identifier of the task to change status'), set: z .object({ status: TaskStatusSchema.optional().describe('The new status of this task'), title: TaskTitleSchema.optional(), description: TaskDescriptionSchema.optional(), goal: TaskGoalSchema.optional(), criticalPath: TaskCriticalPathSchema.optional(), estimatedComplexity: TaskComplexitySchema.optional(), }) .optional() .describe('Optional properties to update on this task'), add: z .object({ dependsOnTaskIDs: TaskIDSchema.array().min(1).optional().describe('New tasks that this task depends on'), definitionsOfDone: TaskDefinitionsOfDoneSchema.optional(), uncertaintyAreas: TaskUncertaintyAreasSchema.optional(), lessonsLearned: z .string() .min(1) .array() .min(1) .optional() .describe('Lessons learned while executing this task that may inform future tasks'), verificationEvidence: z .string() .min(1) .array() .min(1) .optional() .describe( 'Verification evidence that this task was executed as planned, and that the definitions of done were met' ), }) .optional() .describe('Optional properties to add to this task'), remove: z .object({ dependsOnTaskIDs: TaskIDSchema.array().min(1).optional().describe('Tasks that this task no longer depends on'), }) .optional() .describe('Optional properties to remove from this task'), })