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

Method complete_tool_call

core/src/agent/tool_completion_runtime.rs:18–82  ·  view source on GitHub ↗
(
        &self,
        state: &mut ExecutionLoopState,
        input: ToolCompletionInput<'_>,
    )

Source from the content-addressed store, hash-verified

16
17impl AgentLoop {
18 pub(super) async fn complete_tool_call(
19 &self,
20 state: &mut ExecutionLoopState,
21 input: ToolCompletionInput<'_>,
22 ) {
23 let ToolCompletionInput {
24 tool_call,
25 event_tx,
26 session_id,
27 effective_prompt,
28 tool_start,
29 normalized,
30 } = input;
31 let tool_duration = tool_start.elapsed();
32 crate::telemetry::record_tool_result(normalized.exit_code, tool_duration);
33 Self::collect_verification_report(&mut state.verification_reports, &normalized.metadata);
34
35 let output = if let Some(ref sp) = self.config.security_provider {
36 sp.sanitize_output(&normalized.output)
37 } else {
38 normalized.output.clone()
39 };
40
41 state.remember_tool_signature(&tool_call.name, &tool_call.args, normalized.is_error);
42
43 self.fire_post_tool_use(
44 session_id.unwrap_or(""),
45 &tool_call.name,
46 &tool_call.args,
47 &output,
48 normalized.exit_code == 0,
49 tool_duration.as_millis() as u64,
50 )
51 .await;
52
53 self.remember_tool_result(
54 effective_prompt,
55 &tool_call.name,
56 &output,
57 normalized.exit_code,
58 event_tx,
59 )
60 .await;
61
62 if let Some(tx) = event_tx {
63 tx.send(AgentEvent::ToolEnd {
64 id: tool_call.id.clone(),
65 name: tool_call.name.clone(),
66 output: output.clone(),
67 exit_code: normalized.exit_code,
68 metadata: normalized.metadata.clone(),
69 error_kind: normalized.error_kind.clone(),
70 })
71 .await
72 .ok();
73 }
74
75 push_tool_result_message(

Callers 1

Calls 8

record_tool_resultFunction · 0.85
push_tool_result_messageFunction · 0.85
fire_post_tool_useMethod · 0.80
remember_tool_resultMethod · 0.80
sanitize_outputMethod · 0.45
cloneMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected