Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_add_task_dependents

Add dependent tasks to an Asana task to establish workflow dependencies and manage task sequencing within projects.

Instructions

Set dependents for a task (tasks that depend on this task)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID to add dependents to
dependentsYesArray of task IDs that depend on this task

Implementation Reference

  • Handler case in tool_handler switch that destructures arguments and calls AsanaClientWrapper.addTaskDependents to execute the tool logic
    case "asana_add_task_dependents": {
      const { task_id, dependents } = args;
      const response = await asanaClient.addTaskDependents(task_id, dependents);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Core implementation in AsanaClientWrapper that normalizes dependents array and calls Asana TasksApi.addDependentsForTask
    async addTaskDependents(taskId: string, dependents: any) {
      // Ensure dependents is an array
      const dependentsArray = this.ensureArray(dependents);
      
      const body = {
        data: {
          dependents: dependentsArray
        }
      };
      const response = await this.tasks.addDependentsForTask(body, taskId);
      return response.data;
    }
  • Tool definition with input schema specifying task_id and dependents array
    export const addTaskDependentsTool: Tool = {
      name: "asana_add_task_dependents",
      description: "Set dependents for a task (tasks that depend on this task)",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "The task ID to add dependents to"
          },
          dependents: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Array of task IDs that depend on this task"
          }
        },
        required: ["task_id", "dependents"]
      }
    };
  • Registration of the tool in the exported tools array used by MCP
    addTaskDependenciesTool,
    addTaskDependentsTool,
  • Input parameter validation logic for task_id (GID) and dependents array in validateTaskParameters
    case 'asana_add_task_dependents':
      result = validateGid(params.task_id, 'task_id');
      if (!result.valid) errors.push(...result.errors);
      
      // Verificăm dacă dependencies/dependents există și este un array sau string
      const arrayParam = toolName === 'asana_add_task_dependencies' ? 'dependencies' : 'dependents';
      if (!params[arrayParam]) {
        errors.push(`${arrayParam} is required`);
      }
      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