Skip to main content
Glama

asana_create_task

Create a new task in an Asana project with details like name, description, due date, assignee, and custom fields to organize work and track progress.

Instructions

Create a new task in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project to create the task in
nameYesName of the task
notesNoDescription of the task
html_notesNoHTML-like formatted description of the task. Does not support ALL HTML tags. Only a subset. The only allowed TAG in the HTML are: <body> <h1> <h2> <ol> <ul> <li> <strong> <em> <u> <s> <code> <pre> <blockquote> <a data-asana-type="" data-asana-gid=""> <hr> <img> <table> <tr> <td>. No other tags are allowed. Use the \n to create a newline. Do not use \n after <body>. Example: <body><h1>Motivation</h1> A customer called in to complain <h1>Goal</h1> Fix the problem</body>
due_onNoDue date in YYYY-MM-DD format
assigneeNoAssignee (can be 'me' or a user ID)
followersNoArray of user IDs to add as followers
parentNoThe parent task ID to set this task under
projectsNoArray of project IDs to add this task to
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

  • Main execution handler for the 'asana_create_task' tool. Destructures input args into project_id and taskData, calls AsanaClientWrapper.createTask, and provides specialized error handling for HTML notes validation using validateAsanaXml.
    case "asana_create_task": {
      const { project_id, ...taskData } = args;
      try {
        const response = await asanaClient.createTask(project_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 && [400, 500].includes(error.status)) {
          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
      }
    }
  • Defines the Tool metadata including name, description, and comprehensive inputSchema with properties like project_id, name, notes, html_notes, due_on, assignee, custom_fields, etc., and required fields.
    export const createTaskTool: Tool = {
      name: "asana_create_task",
      description: "Create a new task in a project",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The project to create the task in"
          },
          name: {
            type: "string",
            description: "Name of the task"
          },
          notes: {
            type: "string",
            description: "Description of the task"
          },
          html_notes: {
            type: "string",
            description: "HTML-like formatted description of the task. Does not support ALL HTML tags. Only a subset. The only allowed TAG in the HTML are: <body> <h1> <h2> <ol> <ul> <li> <strong> <em> <u> <s> <code> <pre> <blockquote> <a data-asana-type=\"\" data-asana-gid=\"\"> <hr> <img> <table> <tr> <td>. No other tags are allowed. Use the \\n to create a newline. Do not use \\n after <body>. Example: <body><h1>Motivation</h1>\nA customer called in to complain\n<h1>Goal</h1>\nFix the problem</body>"
          },
          due_on: {
            type: "string",
            description: "Due date in YYYY-MM-DD format"
          },
          assignee: {
            type: "string",
            description: "Assignee (can be 'me' or a user ID)"
          },
          followers: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Array of user IDs to add as followers"
          },
          parent: {
            type: "string",
            description: "The parent task ID to set this task under"
          },
          projects: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Array of project IDs to add this task to"
          },
          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: ["project_id", "name"]
      }
    };
  • Registers the createTaskTool (asana_create_task) by including it in the all_tools array, which is filtered based on read-only mode and exported as list_of_tools for the MCP server.
    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,
    ];
  • Supporting method in AsanaClientWrapper that prepares task creation data (adds project to projects array if missing, sets defaults for resource_subtype and custom_fields), then delegates to the Asana SDK TasksApi.createTask.
    async createTask(projectId: string, data: any) {
      // Ensure projects array includes the projectId
      const projects = data.projects || [];
      if (!projects.includes(projectId)) {
        projects.push(projectId);
      }
    
      const taskData = {
        data: {
          ...data,
          projects,
          // Handle resource_subtype if provided
          resource_subtype: data.resource_subtype || 'default_task',
          // Handle custom_fields if provided
          custom_fields: data.custom_fields || {}
        }
      };
      const response = await this.tasks.createTask(taskData);
      return response.data;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create a new task' implies a write/mutation operation, but the description doesn't mention permissions required, whether this is idempotent, rate limits, error conditions, or what happens on success (e.g., returns a task ID). For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a basic create operation and front-loads the essential information without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 11 parameters, no annotations, and no output schema, the description is insufficient. It doesn't address what the tool returns, error handling, authentication requirements, or how it differs from similar tools. The 100% schema coverage helps with parameters, but other critical context is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 11 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema (e.g., it doesn't explain relationships between parameters like 'project_id' vs 'projects', or provide usage examples). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new task in a project' clearly states the action (create) and resource (task), with the project context providing specificity. However, it doesn't differentiate from sibling tools like 'asana_create_subtask' or 'asana_update_task', which would require explicit comparison to earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are multiple sibling tools for task creation and modification (e.g., asana_create_subtask, asana_update_task, asana_set_parent_for_task), but the description offers no context about prerequisites, when this is appropriate versus other tools, or any exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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