MCPcopy Index your code
hub / github.com/AI45Lab/Code / execute_delegated_plan_tool

Method execute_delegated_plan_tool

core/src/agent/tool_execution_runtime.rs:36–77  ·  view source on GitHub ↗
(
        &self,
        tool_name: &str,
        args: &Value,
        session_id: Option<&str>,
        event_tx: &Option<mpsc::Sender<AgentEvent>>,
    )

Source from the content-addressed store, hash-verified

34 }
35
36 pub(super) async fn execute_delegated_plan_tool(
37 &self,
38 tool_name: &str,
39 args: &Value,
40 session_id: Option<&str>,
41 event_tx: &Option<mpsc::Sender<AgentEvent>>,
42 ) -> (String, i32, bool, Option<Value>) {
43 let call_id = format!("plan-{}-{}", tool_name, uuid::Uuid::new_v4());
44 if let Some(tx) = event_tx {
45 tx.send(AgentEvent::ToolStart {
46 id: call_id.clone(),
47 name: tool_name.to_string(),
48 })
49 .await
50 .ok();
51 }
52
53 let ctx = self.tool_context_for_plan(session_id);
54 let normalized = NormalizedToolResult::from_execution(
55 self.execute_tool_timed(tool_name, args, &ctx).await,
56 );
57
58 if let Some(tx) = event_tx {
59 tx.send(AgentEvent::ToolEnd {
60 id: call_id,
61 name: tool_name.to_string(),
62 output: normalized.output.clone(),
63 exit_code: normalized.exit_code,
64 metadata: normalized.metadata.clone(),
65 error_kind: normalized.error_kind.clone(),
66 })
67 .await
68 .ok();
69 }
70
71 (
72 normalized.output,
73 normalized.exit_code,
74 normalized.is_error,
75 normalized.metadata,
76 )
77 }
78
79 /// Execute a tool, applying the configured timeout if set.
80 ///

Callers 2

execute_planMethod · 0.80

Calls 4

tool_context_for_planMethod · 0.80
execute_tool_timedMethod · 0.80
sendMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected