update_task
Modify task properties such as title, description, status, and recommendations for tools or rules. Ensure completed details are provided when marking tasks as done. Follow valid status transitions: not started → in progress → done.
Instructions
Modify a task's properties. Note: (1) completedDetails are required when setting status to 'done', (2) approved tasks cannot be modified, (3) status must follow valid transitions: not started → in progress → done. You can also update tool and rule recommendations to guide task completion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| completedDetails | No | Details about the task completion (required if status is set to 'done'). | |
| description | No | The new description for the task (optional). | |
| projectId | Yes | The ID of the project containing the task (e.g., proj-1). | |
| ruleRecommendations | No | Recommendations for relevant rules to review when completing the task. | |
| status | No | The new status for the task (optional). | |
| taskId | Yes | The ID of the task to update (e.g., task-1). | |
| title | No | The new title for the task (optional). | |
| toolRecommendations | No | Recommendations for tools to use to complete the task. |
Implementation Reference
- src/server/toolExecutors.ts:248-304 (handler)The ToolExecutor for 'update_task' that handles input validation, constructs updates object, and delegates to TaskManager.updateTask.const updateTaskToolExecutor: ToolExecutor = { name: "update_task", async execute(taskManager, args) { const projectId = validateProjectId(args.projectId); const taskId = validateTaskId(args.taskId); const updates: Record<string, string> = {}; if (args.title !== undefined) { updates.title = validateRequiredStringParam(args.title, "title"); } if (args.description !== undefined) { updates.description = validateRequiredStringParam(args.description, "description"); } if (args.toolRecommendations !== undefined) { if (typeof args.toolRecommendations !== "string") { throw new AppError( "Invalid toolRecommendations: must be a string", AppErrorCode.InvalidArgument ); } updates.toolRecommendations = args.toolRecommendations; } if (args.ruleRecommendations !== undefined) { if (typeof args.ruleRecommendations !== "string") { throw new AppError( "Invalid ruleRecommendations: must be a string", AppErrorCode.InvalidArgument ); } updates.ruleRecommendations = args.ruleRecommendations; } if (args.status !== undefined) { const status = args.status; if ( typeof status !== "string" || !["not started", "in progress", "done"].includes(status) ) { throw new AppError( "Invalid status: must be one of 'not started', 'in progress', 'done'", AppErrorCode.InvalidArgument ); } if (status === "done") { updates.completedDetails = validateRequiredStringParam( args.completedDetails, "completedDetails (required when status = 'done')" ); } updates.status = status; } const resultData = await taskManager.updateTask(projectId, taskId, updates); return resultData; }, }; toolExecutorMap.set(updateTaskToolExecutor.name, updateTaskToolExecutor);
- src/server/tools.ts:319-361 (schema)The Tool object definition including name, description, and inputSchema for the 'update_task' tool.const updateTaskTool: Tool = { name: "update_task", description: "Modify a task's properties. Note: (1) completedDetails are required when setting status to 'done', (2) approved tasks cannot be modified, (3) status must follow valid transitions: not started → in progress → done. You can also update tool and rule recommendations to guide task completion.", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project containing the task (e.g., proj-1).", }, taskId: { type: "string", description: "The ID of the task to update (e.g., task-1).", }, title: { type: "string", description: "The new title for the task (optional).", }, description: { type: "string", description: "The new description for the task (optional).", }, status: { type: "string", enum: ["not started", "in progress", "done"], description: "The new status for the task (optional).", }, completedDetails: { type: "string", description: "Details about the task completion (required if status is set to 'done').", }, toolRecommendations: { type: "string", description: "Recommendations for tools to use to complete the task.", }, ruleRecommendations: { type: "string", description: "Recommendations for relevant rules to review when completing the task.", } }, required: ["projectId", "taskId"], // title, description, status are optional, but completedDetails is conditionally required }, };
- src/server/tools.ts:432-448 (registration)Registration of the updateTaskTool in the ALL_TOOLS export array used for MCP tool listing.export const ALL_TOOLS: Tool[] = [ listProjectsTool, readProjectTool, createProjectTool, deleteProjectTool, addTasksToProjectTool, finalizeProjectTool, generateProjectPlanTool, listTasksTool, readTaskTool, createTaskTool, updateTaskTool, deleteTaskTool, approveTaskTool, getNextTaskTool, ];
- src/server/TaskManager.ts:512-556 (helper)The core updateTask method in TaskManager that applies updates to the task object, handles validation, and persists changes.public async updateTask( projectId: string, taskId: string, updates: { title?: string; description?: string; toolRecommendations?: string; ruleRecommendations?: string; status?: "not started" | "in progress" | "done"; completedDetails?: string; } ): Promise<UpdateTaskSuccessData> { await this.ensureInitialized(); await this.reloadFromDisk(); const proj = this.data.projects.find((p) => p.projectId === projectId); if (!proj) { throw new AppError(`Project ${projectId} not found`, AppErrorCode.ProjectNotFound); } if (proj.completed) { throw new AppError('Project is already completed', AppErrorCode.ProjectAlreadyCompleted); } const task = proj.tasks.find((t) => t.id === taskId); if (!task) { throw new AppError(`Task ${taskId} not found`, AppErrorCode.TaskNotFound); } if (task.approved) { throw new AppError('Cannot modify an approved task', AppErrorCode.CannotModifyApprovedTask); } // Apply updates Object.assign(task, updates); // Generate message if needed let message: string | undefined = undefined; if (updates.status === 'done' && proj.autoApprove === false) { message = `Task marked as done but requires human approval.\nTo approve, user should run: npx taskqueue approve-task -- ${projectId} ${taskId}`; } await this.saveTasks(); return { task, message }; }
- src/types/response.ts:69-72 (schema)Type definition for the success response data of update_task.export interface UpdateTaskSuccessData { task: Task; // The updated task object message?: string; // Optional message (e.g., approval reminder) }