add_task_dependency
Establish dependency relationships between tasks to define execution order and manage project workflows within the Helios-9 MCP Server.
Instructions
Add a dependency relationship between tasks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the dependent task | |
| depends_on_task_id | Yes | ID of the task this task depends on | |
| dependency_type | No | Type of dependency relationship | blocks |
Implementation Reference
- src/tools/tasks.ts:514-552 (handler)The main handler function that implements the add_task_dependency tool. It validates input, checks task existence, detects circular dependencies, creates the dependency record in the database, and returns the result with related task information.export const addTaskDependency = requireAuth(async (args: any) => { const { task_id, depends_on_task_id, dependency_type } = AddTaskDependencySchema.parse(args) logger.info('Adding task dependency', { task_id, depends_on_task_id, dependency_type }) // Validate tasks exist const [task, dependsOnTask] = await Promise.all([ supabaseService.getTask(task_id), supabaseService.getTask(depends_on_task_id) ]) if (!task || !dependsOnTask) { throw new Error('One or both tasks not found') } // Check for circular dependencies const hasCircularDependency = await checkCircularDependency(task_id, depends_on_task_id) if (hasCircularDependency) { throw new Error('Cannot create dependency: would create circular dependency') } // Create dependency record const dependency = await supabaseService.createTaskDependency({ task_id, depends_on_task_id, dependency_type, created_at: new Date().toISOString() }) // Note: blocked status doesn't exist in database schema // In a real implementation, you might use metadata or a separate blocking system return { dependency, task: await supabaseService.getTask(task_id), depends_on_task: dependsOnTask, message: `Dependency created: "${task.title}" ${dependency_type} "${dependsOnTask.title}"` } })
- src/tools/tasks.ts:508-512 (schema)Zod schema used for input validation in the addTaskDependency handler.const AddTaskDependencySchema = z.object({ task_id: z.string().min(1), depends_on_task_id: z.string().min(1), dependency_type: z.enum(['blocks', 'subtask', 'related']).default('blocks') })
- src/tools/tasks.ts:483-506 (registration)MCPTool definition for add_task_dependency, including name, description, and JSON input schema for registration.export const addTaskDependencyTool: MCPTool = { name: 'add_task_dependency', description: 'Add a dependency relationship between tasks', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'ID of the dependent task' }, depends_on_task_id: { type: 'string', description: 'ID of the task this task depends on' }, dependency_type: { type: 'string', enum: ['blocks', 'subtask', 'related'], default: 'blocks', description: 'Type of dependency relationship' } }, required: ['task_id', 'depends_on_task_id'] } }
- src/tools/tasks.ts:1157-1167 (registration)Registration of the addTaskDependency handler in the taskHandlers object, mapping tool name to handler function.export const taskHandlers = { list_tasks: listTasks, create_task: createTask, get_task: getTask, update_task: updateTask, add_task_dependency: addTaskDependency, get_task_dependencies: getTaskDependencies, create_task_workflow: createTaskWorkflow, bulk_update_tasks: bulkUpdateTasks, get_task_workflow_status: getTaskWorkflowStatus }
- src/tools/tasks.ts:1145-1155 (registration)Inclusion of addTaskDependencyTool in the exported taskTools collection for tool registration.export const taskTools = { listTasksTool, createTaskTool, getTaskTool, updateTaskTool, addTaskDependencyTool, getTaskDependenciesTool, createTaskWorkflowTool, bulkUpdateTasksTool, getTaskWorkflowStatusTool }