Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_get_tasks_for_section

Retrieve all tasks from a specific project section in Asana, with options to filter by completion date, include custom fields, and manage pagination for large task lists.

Instructions

Get all tasks from a specific section in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
section_idYesThe section ID to get tasks from
opt_fieldsNoComma-separated list of optional fields to include (e.g., 'name,gid,completed,assignee,notes,subtasks')
completed_sinceNoOnly return tasks that are either incomplete or that have been completed since this time (ISO 8601 format)
limitNoNumber of results to return per page (1-100)
offsetNoPagination token from previous response. Required for paginated requests
auto_paginateNoIf true, automatically gets all pages of results (limited by max_pages)
max_pagesNoMaximum pages to fetch when auto_paginate is true

Implementation Reference

  • MCP tool handler case that extracts section_id and options, calls AsanaClientWrapper.getTasksForSection, and returns JSON response.
    case "asana_get_tasks_for_section": {
      const { section_id, ...opts } = args;
      const response = await asanaClient.getTasksForSection(section_id, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Core Asana API wrapper method that calls the Asana SDK's getTasksForSection with section ID and options, handling basic error logging.
    // Metodă nouă pentru a obține task-urile dintr-o secțiune
    async getTasksForSection(sectionId: string, opts: any = {}) {
      try {
        const response = await this.tasks.getTasksForSection(sectionId, opts);
        return response.data;
      } catch (error) {
        console.error("Error in getTasksForSection:", error);
        throw error;
      }
    }
  • Tool schema definition including name, description, and detailed input schema with pagination support.
    export const getTasksForSectionTool: Tool = {
      name: "asana_get_tasks_for_section",
      description: "Get all tasks from a specific section in a project",
      inputSchema: {
        type: "object",
        properties: {
          section_id: {
            type: "string",
            description: "The section ID to get tasks from"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include (e.g., 'name,gid,completed,assignee,notes,subtasks')"
          },
          completed_since: {
            type: "string",
            description: "Only return tasks that are either incomplete or that have been completed since this time (ISO 8601 format)"
          },
          limit: {
            type: "number",
            description: "Number of results to return per page (1-100)"
          },
          offset: {
            type: "string",
            description: "Pagination token from previous response. Required for paginated requests"
          },
          auto_paginate: {
            type: "boolean",
            description: "If true, automatically gets all pages of results (limited by max_pages)",
            default: false
          },
          max_pages: {
            type: "number",
            description: "Maximum pages to fetch when auto_paginate is true",
            default: 10
          }
        },
        required: ["section_id"]
      }
    };
  • Registration of the tool 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 helper that checks section_id is a valid Asana GID.
    case 'asana_get_tasks_for_section':
      result = validateGid(params.section_id, 'section_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