Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_create_task

Create a new task in Asana projects 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 handler case for 'asana_create_task' that destructures input parameters and delegates to AsanaClientWrapper.createTask method.
    case "asana_create_task": {
      const { project_id, ...taskData } = args;
      const response = await asanaClient.createTask(project_id, taskData);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition including inputSchema with properties, descriptions, and required fields for 'asana_create_task'.
    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"]
      }
    };
  • Core implementation of task creation in AsanaClientWrapper, preparing data (ensuring project inclusion, defaults) and calling Asana SDK's createTask.
    async createTask(projectId: string, data: any) {
      try {
        // 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 || {},
            // Asigură-te că task-ul este adăugat la sfârșitul listei
            insert_before: null
          }
        };
        const response = await this.tasks.createTask(taskData);
        return response.data;
      } catch (error: any) {
        console.error(`Error creating task: ${error.message}`);
        // Add useful diagnostics information
        if (error.response && error.response.body) {
          console.error(`Response error details: ${JSON.stringify(error.response.body, null, 2)}`);
        }
        
        // Provide more context about the error
        if (error.message.includes("Missing input")) {
          throw new Error(`Failed to create task: Missing required parameters. ${error.message}`);
        }
        
        if (error.message.includes("Not a valid project")) {
          throw new Error(`Project ID ${projectId} is not valid or you don't have access to it.`);
        }
        
        throw error;
      }
    }
  • Registration of the 'asana_create_task' tool (imported as createTaskTool) in the main tools array exported for MCP server.
    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 logic specific to 'asana_create_task' parameters like project_id, name, due_on.
    case 'asana_create_task':
      result = validateGid(params.project_id, 'project_id');
      if (!result.valid) errors.push(...result.errors);
      
      result = validateString(params.name, 'name', false);
      if (!result.valid) errors.push(...result.errors);
      
      if (params.due_on) {
        result = validateDate(params.due_on, 'due_on');
        if (!result.valid) errors.push(...result.errors);
      }
      break;
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 authentication requirements, permission levels needed, rate limits, whether the operation is idempotent, or what happens on success/failure. For a mutation tool with zero annotation coverage, this represents a significant gap in behavioral context.

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 that states exactly what the tool does without any unnecessary words. It's appropriately sized and front-loaded with the essential information, making it easy for an agent to quickly understand the tool's purpose.

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 insufficiently complete. It doesn't address behavioral aspects like authentication needs, error conditions, or what the tool returns. While the schema covers parameters well, the description fails to provide the broader context needed for an agent to use this tool effectively in practice.

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?

With 100% schema description coverage, the schema already documents all 11 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

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 clearly states the action ('Create') and resource ('new task in a project'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'asana_create_subtask' or 'asana_create_task_story', which would require more specific context about when to use each creation tool.

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. With multiple sibling creation tools (create_project, create_subtask, create_task_story), there's no indication of when this specific task creation tool is appropriate versus those other options, nor any prerequisites or constraints mentioned.

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

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