Register the task delegation tools with optional MCP manager and parent context. When `mcp_manager` is provided, delegated child sessions will have access to all MCP tools from connected servers. When `parent_context` is provided, child runs inherit parent capabilities. When `subagent_tracker` is provided, each task registers a `CancellationToken` against it so callers can cancel by `task_id`.
(
registry: &Arc<ToolRegistry>,
llm_client: Arc<dyn crate::llm::LlmClient>,
agent_registry: Arc<crate::subagent::AgentRegistry>,
workspace: String,
mcp_manager: Option<Arc<crate::m
| 112 | /// When `subagent_tracker` is provided, each task registers a |
| 113 | /// `CancellationToken` against it so callers can cancel by `task_id`. |
| 114 | pub fn register_task_with_mcp( |
| 115 | registry: &Arc<ToolRegistry>, |
| 116 | llm_client: Arc<dyn crate::llm::LlmClient>, |
| 117 | agent_registry: Arc<crate::subagent::AgentRegistry>, |
| 118 | workspace: String, |
| 119 | mcp_manager: Option<Arc<crate::mcp::manager::McpManager>>, |
| 120 | parent_context: Option<crate::child_run::ChildRunContext>, |
| 121 | subagent_tracker: Option<Arc<crate::subagent_task_tracker::InMemorySubagentTaskTracker>>, |
| 122 | ) { |
| 123 | use crate::tools::task::{ParallelTaskTool, TaskExecutor, TaskTool}; |
| 124 | let mut executor = match mcp_manager { |
| 125 | Some(mcp) => TaskExecutor::with_mcp(agent_registry, llm_client, workspace, mcp), |
| 126 | None => TaskExecutor::new(agent_registry, llm_client, workspace), |
| 127 | }; |
| 128 | if let Some(ctx) = parent_context { |
| 129 | executor = executor.with_parent_context(ctx); |
| 130 | } |
| 131 | if let Some(tracker) = subagent_tracker { |
| 132 | executor = executor.with_subagent_tracker(tracker); |
| 133 | } |
| 134 | let executor = Arc::new(executor); |
| 135 | registry.register_builtin(Arc::new(TaskTool::new(Arc::clone(&executor)))); |
| 136 | registry.register_builtin(Arc::new(ParallelTaskTool::new(Arc::clone(&executor)))); |
| 137 | } |
| 138 | |
| 139 | /// Register the Skill tool for skill-based tool access control. |
| 140 | pub(crate) fn register_skill( |
no test coverage detected