asana_update_task
Update an existing Asana task's details including name, notes, due date, assignee, completion status, and custom fields to keep project information current.
Instructions
Update an existing task's details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The task ID to update | |
| name | No | New name for the task | |
| notes | No | New description for the task | |
| due_on | No | New due date in YYYY-MM-DD format | |
| assignee | No | New assignee (can be 'me' or a user ID) | |
| completed | No | Mark task as completed or not | |
| resource_subtype | No | The type of the task. Can be one of 'default_task' or 'milestone' | |
| custom_fields | No | Object mapping custom field GID strings to their values. For enum fields use the enum option GID as the value. |
Implementation Reference
- src/tool-handler.ts:188-226 (handler)Executes the asana_update_task tool by calling AsanaClientWrapper.updateTask with task_id and data, handles response and provides HTML notes validation on errors.case "asana_update_task": { const { task_id, ...taskData } = args; try { const response = await asanaClient.updateTask(task_id, taskData); return { content: [{ type: "text", text: JSON.stringify(response) }], }; } catch (error) { // When error occurs and html_notes was provided, validate it if (taskData.html_notes && error instanceof Error && error.message.includes('400')) { const xmlValidationErrors = validateAsanaXml(taskData.html_notes); if (xmlValidationErrors.length > 0) { // Provide detailed validation errors to help the user return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), validation_errors: xmlValidationErrors, message: "The HTML notes contain invalid XML formatting. Please check the validation errors above." }) }], }; } else { // HTML is valid, something else caused the error return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), html_notes_validation: "The HTML notes format is valid. The error must be related to something else." }) }], }; } } throw error; // re-throw to be caught by the outer try/catch } }
- src/tools/task-tools.ts:324-365 (schema)Tool definition including name, description, and input schema specifying parameters for updating a task.export const updateTaskTool: Tool = { name: "asana_update_task", description: "Update an existing task's details", inputSchema: { type: "object", properties: { task_id: { type: "string", description: "The task ID to update" }, name: { type: "string", description: "New name for the task" }, notes: { type: "string", description: "New description for the task" }, due_on: { type: "string", description: "New due date in YYYY-MM-DD format" }, assignee: { type: "string", description: "New assignee (can be 'me' or a user ID)" }, completed: { type: "boolean", description: "Mark task as completed or not" }, resource_subtype: { type: "string", description: "The type of the task. Can be one of 'default_task' or 'milestone'" }, custom_fields: { type: "object", description: "Object mapping custom field GID strings to their values. For enum fields use the enum option GID as the value." } }, required: ["task_id"] } };
- src/asana-client-wrapper.ts:148-161 (helper)Core implementation in AsanaClientWrapper that constructs the update request body and calls the Asana SDK's TasksApi.updateTask method.async updateTask(taskId: string, data: any) { const body = { data: { ...data, // Handle resource_subtype if provided resource_subtype: data.resource_subtype || undefined, // Handle custom_fields if provided custom_fields: data.custom_fields || undefined } }; const opts = {}; const response = await this.tasks.updateTask(body, taskId, opts); return response.data; }
- src/tool-handler.ts:38-61 (registration)Registers the updateTaskTool (imported from task-tools) in the all_tools array, which is filtered and exported as list_of_tools for the MCP server.const all_tools: Tool[] = [ listWorkspacesTool, searchProjectsTool, searchTasksTool, getTaskTool, createTaskTool, getStoriesForTaskTool, updateTaskTool, getProjectTool, getProjectTaskCountsTool, getProjectSectionsTool, createTaskStoryTool, addTaskDependenciesTool, addTaskDependentsTool, createSubtaskTool, getMultipleTasksByGidTool, getProjectStatusTool, getProjectStatusesForProjectTool, createProjectStatusTool, deleteProjectStatusTool, setParentForTaskTool, getTasksForTagTool, getTagsForWorkspaceTool, ];