add_dependency
Add required libraries, tools, or other dependencies to project requests or specific tasks in TaskFlow MCP to ensure all necessary components are available for execution.
Instructions
Add a dependency to a request or task.
Dependencies can be libraries, tools, or other requirements needed for the project or specific tasks.
If 'taskId' is provided, the dependency will be added to that specific task. Otherwise, it will be added to the request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| taskId | No | ||
| dependency | Yes |
Implementation Reference
- src/tools/TaskFlowTools.ts:640-643 (handler)The handler function that implements the 'add_dependency' tool logic. It extracts the requestId, optional taskId, and dependency from arguments and delegates to the TaskFlowService.addDependency method.async add_dependency(args: any) { const { requestId, taskId, dependency } = args ?? {}; return service.addDependency(String(requestId), dependency, taskId ? String(taskId) : undefined); },
- src/tools/TaskFlowTools.ts:406-423 (schema)The input schema definition used by the 'add_dependency' tool for validating arguments including requestId, optional taskId, and dependency object.inputSchema: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, dependency: { type: "object", properties: { name: { type: "string" }, version: { type: "string" }, url: { type: "string" }, description: { type: "string" }, }, required: ["name"], }, }, required: ["requestId", "dependency"], },
- src/server/TaskFlowServer.ts:63-90 (registration)Registration of the 'add_dependency' tool (as ADD_DEPENDENCY_TOOL) in the MCP server's list of available tools via ListToolsRequestSchema handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ PLAN_TASK_TOOL, GET_NEXT_TASK_TOOL, MARK_TASK_DONE_TOOL, OPEN_TASK_DETAILS_TOOL, LIST_REQUESTS_TOOL, ADD_TASKS_TO_REQUEST_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, ADD_SUBTASKS_TOOL, MARK_SUBTASK_DONE_TOOL, UPDATE_SUBTASK_TOOL, DELETE_SUBTASK_TOOL, EXPORT_TASK_STATUS_TOOL, ADD_NOTE_TOOL, UPDATE_NOTE_TOOL, DELETE_NOTE_TOOL, ADD_DEPENDENCY_TOOL, GET_PROMPTS_TOOL, SET_PROMPTS_TOOL, UPDATE_PROMPTS_TOOL, REMOVE_PROMPTS_TOOL, ARCHIVE_COMPLETED_REQUESTS_TOOL, LIST_ARCHIVED_REQUESTS_TOOL, RESTORE_ARCHIVED_REQUEST_TOOL, ], }));
- The supporting service method that performs the actual addition of a dependency to either a request or specific task, handling persistence and status responses.public async addDependency(requestId: string, dependency: Dependency, taskId?: string) { await this.loadTasks(); const req = this.getRequest(requestId); if (!req) return { status: "error", message: "Request not found" }; if (taskId) { const task = req.tasks.find((t) => t.id === taskId); if (!task) return { status: "error", message: "Task not found" }; if (!task.dependencies) task.dependencies = []; task.dependencies.push(dependency); await this.saveTasks(); return { status: "dependency_added_to_task", message: `Dependency "${dependency.name}" has been added to task ${taskId}.`, dependency, }; } else { if (!req.dependencies) req.dependencies = []; req.dependencies.push(dependency); await this.saveTasks(); return { status: "dependency_added_to_request", message: `Dependency "${dependency.name}" has been added to request ${requestId}.`, dependency, }; } }
- Additional schema definition for 'add_dependency' tool inputs, referencing a shared dependencyJson schema.add_dependency: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, dependency: dependencyJson, }, required: ["requestId", "dependency"], },