Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_get_subtasks_for_task

Retrieve subtasks for any Asana task to track progress, assign responsibilities, and manage dependencies within projects.

Instructions

Get the list of subtasks for a specific task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesID of the task to get subtasks for
opt_fieldsNoOptional fields for subtasks (e.g. 'name,notes,assignee,due_on,completed')
limitNoMaximum number of results per page (1-100)
offsetNoPagination token from previous response
auto_paginateNoIf true, automatically gets all pages and combines results

Implementation Reference

  • MCP tool handler switch case that destructures input arguments (task_id and opts), calls AsanaClientWrapper.getSubtasksForTask(), and returns the JSON-stringified response.
    case "asana_get_subtasks_for_task": {
      const { task_id, ...opts } = args;
      const response = await asanaClient.getSubtasksForTask(task_id, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Core implementation in AsanaClientWrapper that calls the Asana SDK TasksApi.getSubtasksForTask(taskId, opts) and returns the data, with basic error handling.
    async getSubtasksForTask(taskId: string, opts: any = {}) {
      try {
        const response = await this.tasks.getSubtasksForTask(taskId, opts);
        return response.data;
      } catch (error) {
        console.error("Error in getSubtasksForTask:", error);
        throw error;
      }
    }
  • Tool schema definition including name, description, and inputSchema with required task_id and optional pagination/fields parameters.
    export const getSubtasksForTaskTool: Tool = {
      name: "asana_get_subtasks_for_task",
      description: "Get the list of subtasks for a specific task",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "ID of the task to get subtasks for"
          },
          opt_fields: {
            type: "string",
            description: "Optional fields for subtasks (e.g. 'name,notes,assignee,due_on,completed')"
          },
          limit: {
            type: "number",
            description: "Maximum number of results per page (1-100)"
          },
          offset: {
            type: "string",
            description: "Pagination token from previous response"
          },
          auto_paginate: {
            type: "boolean",
            description: "If true, automatically gets all pages and combines results",
            default: false
          }
        },
        required: ["task_id"]
      }
    };
  • Tool registration in the exported tools array that includes getSubtasksForTaskTool (imported from task-tools.ts), making it available to the 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
    ];

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