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

Function build_tool_context

core/src/agent_api/session_runtime.rs:106–125  ·  view source on GitHub ↗
(
    code_config: &CodeConfig,
    _workspace: &Path,
    opts: &SessionOptions,
    tool_executor: Arc<ToolExecutor>,
    agent_event_tx: broadcast::Sender<AgentEvent>,
)

Source from the content-addressed store, hash-verified

104}
105
106fn build_tool_context(
107 code_config: &CodeConfig,
108 _workspace: &Path,
109 opts: &SessionOptions,
110 tool_executor: Arc<ToolExecutor>,
111 agent_event_tx: broadcast::Sender<AgentEvent>,
112) -> ToolContext {
113 let mut tool_context = tool_executor.registry().context();
114 if let Some(ref search_config) = code_config.search {
115 tool_context = tool_context.with_search_config(search_config.clone());
116 }
117 tool_context = tool_context.with_agent_event_tx(agent_event_tx);
118
119 if let Some(handle) = opts.sandbox_handle.clone() {
120 tool_executor.registry().set_sandbox(Arc::clone(&handle));
121 tool_context = tool_context.with_sandbox(handle);
122 }
123
124 tool_context
125}

Callers 1

build_session_runtimeFunction · 0.85

Calls 7

contextMethod · 0.80
registryMethod · 0.80
with_search_configMethod · 0.80
with_agent_event_txMethod · 0.80
set_sandboxMethod · 0.80
with_sandboxMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected