asana_update_task
Modify existing Asana task details including name, description, 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:190-196 (handler)The switch case handler that executes the "asana_update_task" tool by destructuring the task_id and passing the remaining taskData to asanaClient.updateTask, then returning the JSON-stringified response.case "asana_update_task": { const { task_id, ...taskData } = args; const response = await asanaClient.updateTask(task_id, taskData); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/asana-client-wrapper.ts:388-422 (handler)The core AsanaClientWrapper.updateTask method that processes input data (including custom fields parsing), constructs the API request body, calls the Asana TasksApi.updateTask, and handles specific errors like custom field issues.async updateTask(taskId: string, data: any) { // Create a deep clone of the data to avoid modifying the original const taskData = JSON.parse(JSON.stringify(data)); // Handle custom fields properly if provided if (taskData.custom_fields) { try { // Import utils only when needed (avoiding circular dependencies) const { parseCustomFields } = await import('./utils/field-utils.js'); taskData.custom_fields = parseCustomFields(taskData.custom_fields); } catch (err) { throw new Error(`Error processing custom fields: ${(err as Error).message}`); } } try { const body = { data: { ...taskData, // Handle resource_subtype if provided resource_subtype: taskData.resource_subtype || undefined, } }; const opts = {}; const response = await this.tasks.updateTask(body, taskId, opts); return response.data; } catch (error: any) { // Add more context for custom field errors if (error.message?.includes('custom_field')) { throw new Error(`Error updating custom fields: ${error.message}. Make sure you're using the correct format for each field type.`); } throw error; } }
- src/tools/task-tools.ts:324-365 (schema)The complete Tool definition for "asana_update_task" including name, description, and detailed inputSchema specifying required task_id and optional fields like name, notes, due_on, assignee, completed, resource_subtype, and custom_fields.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:61-103 (registration)The tools array registration where updateTaskTool is included among all available MCP tools, making it discoverable and callable.export const tools: Tool[] = [ listWorkspacesTool, searchProjectsTool, getProjectTool, getProjectTaskCountsTool, getProjectSectionsTool, createSectionForProjectTool, createProjectForWorkspaceTool, updateProjectTool, reorderSectionsTool, getProjectStatusTool, getProjectStatusesForProjectTool, createProjectStatusTool, deleteProjectStatusTool, searchTasksTool, getTaskTool, createTaskTool, updateTaskTool, createSubtaskTool, getMultipleTasksByGidTool, addTaskToSectionTool, getTasksForSectionTool, getProjectHierarchyTool, getSubtasksForTaskTool, getTasksForProjectTool, getTasksForTagTool, getTagsForWorkspaceTool, addTagsToTaskTool, addTaskDependenciesTool, addTaskDependentsTool, setParentForTaskTool, addFollowersToTaskTool, getStoriesForTaskTool, createTaskStoryTool, getTeamsForUserTool, getTeamsForWorkspaceTool, addMembersForProjectTool, addFollowersForProjectTool, getUsersForWorkspaceTool, getAttachmentsForObjectTool, uploadAttachmentForObjectTool, downloadAttachmentTool ];
- src/utils/validation.ts:220-223 (schema)Validation logic in validateTaskParameters that ensures task_id is a valid Asana GID for the asana_update_task tool.case 'asana_update_task': result = validateGid(params.task_id, 'task_id'); if (!result.valid) errors.push(...result.errors); break;