update_task
Modify task details such as name, description, notes, dependencies, related files, implementation guide, and verification criteria. Ensures updates align with task status, allowing comprehensive task management and tracking.
Instructions
Update task content, including name, description and notes, dependent tasks, related files, implementation guide and verification criteria. Completed tasks only allow updating summary and related files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dependencies | No | New dependency relationships for the task (optional) | |
| description | No | New description content for the task (optional) | |
| implementationGuide | No | New implementation guide for the task (optional) | |
| name | No | New name for the task (optional) | |
| notes | No | New supplementary notes for the task (optional) | |
| relatedFiles | No | List of files related to the task, used to record code files, reference materials, files to be created, etc. related to the task (optional) | |
| taskId | Yes | Unique identifier of the task to update, must be an existing and unfinished task ID in the system | |
| verificationCriteria | No | New verification criteria for the task (optional) |
Implementation Reference
- src/tools/taskTools.ts:942-1054 (handler)The core handler function for the 'update_task' tool. Validates input parameters, checks task existence, performs the update via modelUpdateTaskContent, handles errors, and returns a formatted response using getUpdateTaskContentPrompt.export async function updateTaskContent({ taskId, name, description, notes, relatedFiles, dependencies, implementationGuide, verificationCriteria, }: z.infer<typeof updateTaskContentSchema>) { if (relatedFiles) { for (const file of relatedFiles) { if ( (file.lineStart && !file.lineEnd) || (!file.lineStart && file.lineEnd) || (file.lineStart && file.lineEnd && file.lineStart > file.lineEnd) ) { return { content: [ { type: "text" as const, text: getUpdateTaskContentPrompt({ taskId, validationError: "Invalid line number settings: must set both start and end lines, and the start line must be less than the end line", }), }, ], }; } } } if ( !( name || description || notes || dependencies || implementationGuide || verificationCriteria || relatedFiles ) ) { return { content: [ { type: "text" as const, text: getUpdateTaskContentPrompt({ taskId, emptyUpdate: true, }), }, ], }; } // Get the task to check if it exists const task = await getTaskById(taskId); if (!task) { return { content: [ { type: "text" as const, text: getUpdateTaskContentPrompt({ taskId, }), }, ], isError: true, }; } // Record the task and content to be updated let updateSummary = `Preparing to update task: ${task.name} (ID: ${task.id})`; if (name) updateSummary += `, new name: ${name}`; if (description) updateSummary += `, update description`; if (notes) updateSummary += `, update notes`; if (relatedFiles) updateSummary += `, update related files (${relatedFiles.length})`; if (dependencies) updateSummary += `, update dependencies (${dependencies.length})`; if (implementationGuide) updateSummary += `, update implementation guide`; if (verificationCriteria) updateSummary += `, update verification criteria`; // Execute the update operation const result = await modelUpdateTaskContent(taskId, { name, description, notes, relatedFiles, dependencies, implementationGuide, verificationCriteria, }); return { content: [ { type: "text" as const, text: getUpdateTaskContentPrompt({ taskId, task, success: result.success, message: result.message, updatedTask: result.task, }), }, ], isError: !result.success, }; }
- src/tools/taskTools.ts:889-940 (schema)Zod schema defining the input structure and validation for the 'update_task' tool, including taskId (required UUID), optional fields like name, description, notes, dependencies, relatedFiles, etc.export const updateTaskContentSchema = z.object({ taskId: z .string() .uuid({ message: "Invalid task ID format, please provide a valid UUID format" }) .describe("Unique identifier of the task to update, must be an existing and unfinished task ID in the system"), name: z.string().optional().describe("New name for the task (optional)"), description: z.string().optional().describe("New description content for the task (optional)"), notes: z.string().optional().describe("New supplementary notes for the task (optional)"), dependencies: z .array(z.string()) .optional() .describe("New dependency relationships for the task (optional)"), relatedFiles: z .array( z.object({ path: z .string() .min(1, { message: "File path cannot be empty, please provide a valid file path" }) .describe("File path, can be a path relative to the project root directory or an absolute path"), type: z .nativeEnum(RelatedFileType) .describe( "Relationship type between the file and task (TO_MODIFY, REFERENCE, CREATE, DEPENDENCY, OTHER)" ), description: z.string().optional().describe("Supplementary description of the file (optional)"), lineStart: z .number() .int() .positive() .optional() .describe("Starting line of the relevant code block (optional)"), lineEnd: z .number() .int() .positive() .optional() .describe("Ending line of the relevant code block (optional)"), }) ) .optional() .describe( "List of files related to the task, used to record code files, reference materials, files to be created, etc. related to the task (optional)" ), implementationGuide: z .string() .optional() .describe("New implementation guide for the task (optional)"), verificationCriteria: z .string() .optional() .describe("New verification criteria for the task (optional)"), });
- src/index.ts:297-303 (registration)Registration of the 'update_task' tool in the MCP server's ListToolsRequestHandler, specifying name, description from MD file, and input schema converted to JSON schema.{ name: "update_task", description: loadPromptFromTemplate( "toolsDescription/updateTask.md" ), inputSchema: zodToJsonSchema(updateTaskContentSchema), },
- src/index.ts:513-526 (handler)Dispatch handler in the central CallToolRequest handler that parses arguments with the schema and invokes the updateTaskContent function for 'update_task' tool calls.case "update_task": parsedArgs = await updateTaskContentSchema.safeParseAsync( request.params.arguments ); if (!parsedArgs.success) { throw new Error( `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}` ); } taskId = parsedArgs.data.taskId; await saveRequest(); result = await updateTaskContent(parsedArgs.data); await saveResponse(result); return result;
- src/models/taskModel.ts:209-227 (helper)Model-level helper function updateTaskContent that performs the actual database update for task content, called by the tool handler.export async function updateTaskContent( taskId: string, updates: { name?: string; description?: string; notes?: string; relatedFiles?: RelatedFile[]; dependencies?: string[]; implementationGuide?: string; verificationCriteria?: string; } ): Promise<{ success: boolean; message: string; task?: Task }> { // Get task and check if it exists const task = await getTaskById(taskId); if (!task) { return { success: false, message: "Task not found" }; }