MCPcopy Create free account
hub / github.com/AI45Lab/Code / register_task_with_mcp

Function register_task_with_mcp

core/src/tools/builtin/mod.rs:114–137  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

112/// When `subagent_tracker` is provided, each task registers a
113/// `CancellationToken` against it so callers can cancel by `task_id`.
114pub 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.
140pub(crate) fn register_skill(

Callers 2

register_taskFunction · 0.85
register_task_capabilityFunction · 0.85

Calls 3

with_parent_contextMethod · 0.80
with_subagent_trackerMethod · 0.80
register_builtinMethod · 0.45

Tested by

no test coverage detected