Skip to main content
Glama

asana_set_parent_for_task

Set a task's parent and position it within subtasks to organize project hierarchies in Asana.

Instructions

Set the parent of a task and position the subtask within the other subtasks of that parent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
task_idYesThe task ID to operate on
optsNo

Implementation Reference

  • Handler logic for executing the 'asana_set_parent_for_task' tool, which handles argument parsing and delegates to the Asana client wrapper.
    case "asana_set_parent_for_task": {
      let { data, task_id, opts } = args;
      if (typeof data == "string") {
        data = JSON.parse(data);
      }
      if (typeof opts == "string") {
        opts = JSON.parse(opts);
      }
      const response = await asanaClient.setParentForTask(data, task_id, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Schema definition including name, description, and input schema for the 'asana_set_parent_for_task' tool.
    export const setParentForTaskTool: Tool = {
      name: "asana_set_parent_for_task",
      description: "Set the parent of a task and position the subtask within the other subtasks of that parent",
      inputSchema: {
        type: "object",
        properties: {
          data: {
            parent: {
              type: "string",
              description: "The GID of the new parent of the task, or null for no parent",
              required: true
            },
            insert_after: {
              type: "string",
              description: "A subtask of the parent to insert the task after, or null to insert at the beginning of the list. Cannot be used with insert_before. The task must already be set as a subtask of that parent."
            },
            insert_before: {
              type: "string",
              description: "A subtask of the parent to insert the task before, or null to insert at the end of the list. Cannot be used with insert_after. The task must already be set as a subtask of that parent."
            },
          },
          task_id: {
            type: "string",
            description: "The task ID to operate on"
          },
          opts: {
            opt_fields: {
              type: "string",
              description: "Comma-separated list of optional fields to include"
            }
          }
        },
        required: ["task_id", "data"]
      }
    };
  • The setParentForTaskTool is included in the all_tools array, which is used to generate the list_of_tools for MCP tool registration.
    setParentForTaskTool,
  • Import of the setParentForTaskTool schema required for tool registration.
      addTaskDependenciesTool,
      addTaskDependentsTool,
      setParentForTaskTool
    } from './tools/task-relationship-tools.js';
  • Helper method in AsanaClientWrapper that wraps the underlying Asana API call for setting a task's parent.
    async setParentForTask(data: any, taskId: string, opts: any = {}) {
      const response = await this.tasks.setParentForTask({ data }, taskId, opts);
      return response.data;
    }

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/roychri/mcp-server-asana'

If you have feedback or need assistance with the MCP directory API, please join our Discord server