Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_add_task_to_section

Add a task to a specific section in an Asana project to organize project workflows and maintain task structure.

Instructions

Add a task to a specific section in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
section_idYesThe section ID to add the task to
task_idYesThe task ID to add to the section
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • MCP tool handler case that destructures input parameters (section_id, task_id, opts) and delegates execution to AsanaClientWrapper.addTaskToSection method.
    case "asana_add_task_to_section": {
      const { section_id, task_id, ...opts } = args;
      const response = await asanaClient.addTaskToSection(section_id, task_id, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Core execution logic: constructs request data with task GID and insert_before:null, calls Asana SectionsApi.addTaskForSection or fallback direct HTTP POST to /sections/{sectionId}/addTask endpoint.
    async addTaskToSection(sectionId: string, taskId: string, opts: any = {}) {
      const data = {
        data: {
          task: taskId,
          insert_before: null
        }
      };
      try {
        const response = await this.sections.addTaskForSection(sectionId, data, opts);
        return response.data;
      } catch (error) {
        console.error("Error in addTaskToSection:", error);
        // Dacă obținem eroare, încercăm metoda alternativă folosind callApi direct
        try {
          const client = Asana.ApiClient.instance;
          const response = await client.callApi(
            `/sections/${sectionId}/addTask`,
            'POST',
            { section_gid: sectionId },
            {},
            {},
            {},
            { data: { task: taskId, insert_before: null } },
            ['token'],
            ['application/json'],
            ['application/json'],
            'Blob'
          );
          return response.data;
        } catch (fallbackError) {
          console.error("Error in fallback method:", fallbackError);
          throw fallbackError;
        }
      }
    }
  • Tool schema definition including name, description, and inputSchema specifying required section_id and task_id parameters.
    export const addTaskToSectionTool: Tool = {
      name: "asana_add_task_to_section",
      description: "Add a task to a specific section in a project",
      inputSchema: {
        type: "object",
        properties: {
          section_id: {
            type: "string",
            description: "The section ID to add the task to"
          },
          task_id: {
            type: "string",
            description: "The task ID to add to the section"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: ["section_id", "task_id"]
      }
    };
  • Tool registration: imports addTaskToSectionTool from task-tools.ts (line 33) and includes it in the exported tools array used for MCP tool registration.
    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 helper: ensures task_id and section_id are valid Asana GIDs in validateSectionParameters.
    case 'asana_add_task_to_section':
      result = validateGid(params.task_id, 'task_id');
      if (!result.valid) errors.push(...result.errors);
      
      result = validateGid(params.section_id, 'section_id');
      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 the full burden of behavioral disclosure. While 'Add' implies a mutation operation, it doesn't specify whether this requires specific permissions, what happens if the task is already in the section, whether the operation is idempotent, or what the response looks like. This leaves significant gaps for an agent to understand the tool's behavior.

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 the core purpose without unnecessary words. It's appropriately sized for a straightforward tool and is front-loaded with the essential information.

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 no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, or behavioral nuances. Given the complexity of modifying project structures in Asana, more context about the operation's effects and limitations would be necessary for an agent to use it effectively.

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?

The schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any additional meaning about the parameters beyond what's in the schema, such as format examples or constraints. This meets the baseline expectation when schema coverage is complete.

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 ('Add') and target resources ('task to a specific section in a project'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'asana_reorder_sections' or 'asana_get_tasks_for_section', which would require a more specific distinction.

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's no mention of prerequisites (e.g., existing task and section), when not to use it, or how it differs from related tools like 'asana_update_task' or 'asana_create_section_for_project'.

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