Skip to main content
Glama
cristip73
by cristip73

asana_update_task

Modify existing task details including name, description, due date, assignee, completion status, and custom fields in Asana projects.

Instructions

Update an existing task's details

Input Schema

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

Implementation Reference

  • Core handler function that processes the update data (including custom fields via field-utils helper), constructs the API request body, and calls the Asana TasksApi.updateTask method to perform the task update.
    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; } }
  • Tool definition including name, description, and input schema for parameter validation.
    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"] } };
  • MCP tool dispatcher case that destructures input arguments and delegates execution to AsanaClientWrapper.updateTask.
    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) }], }; }
  • Registration of the tool in the global tools array exported for MCP server listing.
    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 ];
  • Input validation specifically for task_id GID format in validateTaskParameters.
    case 'asana_update_task': result = validateGid(params.task_id, 'task_id'); if (!result.valid) errors.push(...result.errors); break;

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/cristip73/mcp-server-asana'

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