Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_add_task_dependencies

Set task dependencies in Asana by linking tasks that must be completed before others can start, ensuring proper workflow sequencing.

Instructions

Set dependencies for a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID to add dependencies to
dependenciesYesArray of task IDs that this task depends on

Implementation Reference

  • Tool handler case that destructures the input arguments (task_id, dependencies) and calls the AsanaClientWrapper.addTaskDependencies method, returning the JSON stringified response.
    case "asana_add_task_dependencies": {
      const { task_id, dependencies } = args;
      const response = await asanaClient.addTaskDependencies(task_id, dependencies);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the MCP Tool object with name, description, and inputSchema specifying required task_id (string) and dependencies (array of strings).
    export const addTaskDependenciesTool: Tool = {
      name: "asana_add_task_dependencies",
      description: "Set dependencies for a task",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "The task ID to add dependencies to"
          },
          dependencies: {
            type: "array",
            items: {
              type: "string"
            },
            description: "Array of task IDs that this task depends on"
          }
        },
        required: ["task_id", "dependencies"]
      }
    };
  • Registers the addTaskDependenciesTool in the exported tools array used by the MCP server.
    addTagsToTaskTool,
    addTaskDependenciesTool,
    addTaskDependentsTool,
    setParentForTaskTool,
    addFollowersToTaskTool,
  • AsanaClientWrapper helper method that normalizes the dependencies to an array and makes the API call to Asana's TasksApi.addDependenciesForTask.
    async addTaskDependencies(taskId: string, dependencies: any) {
      // Ensure dependencies is an array
      const dependenciesArray = this.ensureArray(dependencies);
      
      const body = {
        data: {
          dependencies: dependenciesArray
        }
      };
      const response = await this.tasks.addDependenciesForTask(body, taskId);
      return response.data;
    }
  • Validation logic specific to this tool: validates task_id as a valid GID and ensures dependencies parameter is present.
    case 'asana_add_task_dependencies':
    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