asana_add_task_dependencies
Set task dependencies in Asana by linking tasks that must be completed before others can begin, ensuring proper workflow sequencing and project management.
Instructions
Set dependencies for a task
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The task ID to add dependencies to | |
| dependencies | Yes | Array of task IDs that this task depends on |
Input Schema (JSON Schema)
{
"properties": {
"dependencies": {
"description": "Array of task IDs that this task depends on",
"items": {
"type": "string"
},
"type": "array"
},
"task_id": {
"description": "The task ID to add dependencies to",
"type": "string"
}
},
"required": [
"task_id",
"dependencies"
],
"type": "object"
}
Implementation Reference
- src/asana-client-wrapper.ts:466-477 (handler)Core handler function that implements the tool logic by preparing the request body and calling the Asana SDK's addDependenciesForTask method.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; }
- src/tool-handler.ts:262-268 (handler)Tool dispatch handler that extracts parameters and calls the AsanaClientWrapper's addTaskDependencies method.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 Tool object with name, description, and input schema for validating tool calls.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"] } };
- src/tool-handler.ts:61-102 (registration)Registers the addTaskDependenciesTool in the main tools array used by 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
- src/utils/validation.ts:225-235 (helper)Validates task_id as a valid Asana GID and ensures dependencies array is provided before tool execution.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;