asana_update_task
Modify existing Asana task details including name, description, due date, assignee, completion status, and custom fields using task ID.
Instructions
Update an existing task's details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | No | New assignee (can be 'me' or a user ID) | |
| completed | No | Mark task as completed or not | |
| custom_fields | No | Object mapping custom field GID strings to their values. For enum fields use the enum option GID as the value. | |
| due_on | No | New due date in YYYY-MM-DD format | |
| name | No | New name for the task | |
| notes | No | New description for the task | |
| resource_subtype | No | The type of the task. Can be one of 'default_task' or 'milestone' | |
| task_id | Yes | The task ID to update |
Implementation Reference
- src/tool-handler.ts:188-226 (handler)Handler logic for 'asana_update_task' tool: calls AsanaClientWrapper.updateTask with task_id and data, includes error handling and HTML notes XML validation.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)Schema definition for the 'asana_update_task' tool, including input parameters like task_id, name, notes, due_on, assignee, completed, etc.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/tool-handler.ts:38-61 (registration)Registration of 'asana_update_task' via inclusion of updateTaskTool in the all_tools array, which is exported as list_of_tools.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, ];
- src/asana-client-wrapper.ts:148-161 (helper)Core helper method in AsanaClientWrapper that performs the actual Asana API updateTask call, processing data for custom_fields and resource_subtype.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:22-25 (registration)Import statement registering updateTaskTool for use in tool handler.updateTaskTool, createSubtaskTool, getMultipleTasksByGidTool } from './tools/task-tools.js';