Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_create_section_for_project

Create a new section within an Asana project to organize tasks and improve project structure.

Instructions

Create a new section in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project ID to create the section in
nameYesName of the section to create
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • The main handler logic for the tool in the switch statement. It destructures the required parameters (project_id, name) and optional opts from the arguments, calls the Asana client wrapper method, and returns the JSON-stringified response.
    case "asana_create_section_for_project": {
      const { project_id, name, ...opts } = args;
      const response = await asanaClient.createSectionForProject(project_id, name, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the tool's metadata including name, description, and input schema with required fields project_id and name, and optional opt_fields.
    export const createSectionForProjectTool: Tool = {
      name: "asana_create_section_for_project",
      description: "Create a new section in a project",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The project ID to create the section in"
          },
          name: {
            type: "string",
            description: "Name of the section to create"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: ["project_id", "name"]
      }
    };
  • Registers the tool by including createSectionForProjectTool in the exported tools array used for MCP tool handling.
    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
    ];
  • Core helper method in AsanaClientWrapper that performs the actual API call to create a section using Asana SectionsApi, with error handling and fallback to direct API call.
    async createSectionForProject(projectId: string, name: string, opts: any = {}) {
      try {
        const body = {
          data: {
            name
          }
        };
        // Schimbăm ordinea parametrilor conform documentației Asana
        const response = await this.sections.createSectionForProject(projectId, body, opts);
        return response.data;
      } catch (error) {
        console.error(`Error creating section for project: ${error}`);
        // Dacă obținem eroare, încercăm metoda alternativă folosind callApi direct
        try {
          const client = Asana.ApiClient.instance;
          const response = await client.callApi(
            `/projects/${projectId}/sections`,
            'POST',
            { project_gid: projectId },
            {},
            {},
            {},
            { data: { name } },
            ['token'],
            ['application/json'],
            ['application/json'],
            'Blob'
          );
          return response.data;
        } catch (fallbackError) {
          console.error("Error in fallback method:", fallbackError);
          throw fallbackError;
        }
      }
    }
  • Validates the input parameters for the tool: project_id as GID and name as required string.
    case 'asana_create_section_for_project':
      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);
      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. It states the tool creates a section, implying a write/mutation operation, but doesn't cover permissions, side effects, error handling, or what the response looks like. This leaves significant gaps for an agent to understand how to use it safely and effectively.

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, clear sentence with no wasted words. It's front-loaded with the core purpose and efficiently communicates the essential action 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?

Given the complexity (a write operation with no annotations and no output schema), the description is incomplete. It doesn't address behavioral aspects like permissions, error cases, or response format, which are critical for an agent to use this tool correctly in context.

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 (project_id, name, opt_fields). The description doesn't add any meaning beyond this, such as explaining what 'opt_fields' might include or providing examples. The baseline score of 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 clearly states the action ('Create a new section') and the target resource ('in a project'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'asana_reorder_sections' or 'asana_get_project_sections', which also deal with sections but perform different operations.

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. It doesn't mention prerequisites (e.g., needing an existing project), exclusions, or comparisons to similar tools like 'asana_reorder_sections' or 'asana_get_project_sections'.

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