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

Method decide_tool_gate

core/src/agent/tool_gate_runtime.rs:12–38  ·  view source on GitHub ↗
(
        &self,
        tool_call: &ToolCall,
        state: &ExecutionLoopState,
        session_id: Option<&str>,
    )

Source from the content-addressed store, hash-verified

10
11impl AgentLoop {
12 pub(super) async fn decide_tool_gate(
13 &self,
14 tool_call: &ToolCall,
15 state: &ExecutionLoopState,
16 session_id: Option<&str>,
17 ) -> ToolGateDecision {
18 let pre_tool_block = match self
19 .fire_pre_tool_use(
20 session_id.unwrap_or(""),
21 &tool_call.name,
22 &tool_call.args,
23 state.recent_tool_signatures(),
24 )
25 .await
26 {
27 Some(crate::hooks::HookResult::Block(reason)) => Some(reason),
28 _ => None,
29 };
30
31 ToolSafetyGate::new(&self.config)
32 .decide(ToolGateInput {
33 tool_name: &tool_call.name,
34 args: &tool_call.args,
35 pre_tool_block,
36 })
37 .await
38 }
39
40 pub(super) async fn resolve_tool_gate_decision(
41 &self,

Callers 1

Calls 3

fire_pre_tool_useMethod · 0.80
decideMethod · 0.80

Tested by

no test coverage detected