Skip to main content
Glama

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
NameRequiredDescriptionDefault
assigneeNoNew assignee (can be 'me' or a user ID)
completedNoMark task as completed or not
custom_fieldsNoObject mapping custom field GID strings to their values. For enum fields use the enum option GID as the value.
due_onNoNew due date in YYYY-MM-DD format
nameNoNew name for the task
notesNoNew description for the task
resource_subtypeNoThe type of the task. Can be one of 'default_task' or 'milestone'
task_idYesThe task ID to update

Implementation Reference

  • 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 } }
  • 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"] } };
  • 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, ];
  • 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; }
  • Import statement registering updateTaskTool for use in tool handler.
    updateTaskTool, createSubtaskTool, getMultipleTasksByGidTool } from './tools/task-tools.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/roychri/mcp-server-asana'

If you have feedback or need assistance with the MCP directory API, please join our Discord server