Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_create_subtask

Add subtasks to existing Asana tasks to break down work into manageable components, track progress, and organize project details effectively.

Instructions

Create a new subtask for an existing task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_task_idYesThe parent task ID to create the subtask under
nameYesName of the subtask
notesNoDescription of the subtask
due_onNoDue date in YYYY-MM-DD format
assigneeNoAssignee (can be 'me' or a user ID)
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • The handler case in the tool_handler switch statement that executes the asana_create_subtask tool by destructuring input arguments and calling the AsanaClientWrapper.createSubtask method.
    case "asana_create_subtask": {
      const { parent_task_id, opt_fields, ...taskData } = args;
      const response = await asanaClient.createSubtask(parent_task_id, taskData, { opt_fields });
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • The Tool object definition providing the input schema, description, and name for the asana_create_subtask tool.
    export const createSubtaskTool: Tool = {
      name: "asana_create_subtask",
      description: "Create a new subtask for an existing task",
      inputSchema: {
        type: "object",
        properties: {
          parent_task_id: {
            type: "string",
            description: "The parent task ID to create the subtask under"
          },
          name: {
            type: "string",
            description: "Name of the subtask"
          },
          notes: {
            type: "string",
            description: "Description of the subtask"
          },
          due_on: {
            type: "string",
            description: "Due date in YYYY-MM-DD format"
          },
          assignee: {
            type: "string",
            description: "Assignee (can be 'me' or a user ID)"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: ["parent_task_id", "name"]
      }
    };
  • Registration of the tool in the main tools array exported from tool-handler.ts, which aggregates all MCP tools.
    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
    ];
  • The AsanaClientWrapper method that wraps the Asana SDK call to createSubtaskForTask, preparing the request data and handling the API response.
    async createSubtask(parentTaskId: string, data: any, opts: any = {}) {
      const taskData = {
        data: {
          ...data,
          // Asigură-te că subtask-ul este adăugat la sfârșitul listei
          insert_before: null
        }
      };
      const response = await this.tasks.createSubtaskForTask(taskData, parentTaskId, opts);
      return response.data;
    }
  • Import statement that brings the createSubtaskTool into tool-handler.ts for registration in the tools list.
    import {
      searchTasksTool,
      getTaskTool,
      createTaskTool,
      updateTaskTool,
      createSubtaskTool,
      getMultipleTasksByGidTool,
      addTaskToSectionTool,
      getTasksForSectionTool,
      getProjectHierarchyTool,
      getSubtasksForTaskTool,
      getTasksForProjectTool
    } from './tools/task-tools.js';

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