Skip to main content
Glama
cristip73
by cristip73

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
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

  • 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) }], }; }
  • 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; } }
  • 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"] } };
  • 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 ];
  • 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;

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