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

Method fire_post_tool_use

core/src/agent/hook_runtime.rs:42–74  ·  view source on GitHub ↗

Fire PostToolUse hook event after tool execution (fire-and-forget).

(
        &self,
        session_id: &str,
        tool_name: &str,
        args: &serde_json::Value,
        output: &str,
        success: bool,
        duration_ms: u64,
    )

Source from the content-addressed store, hash-verified

40
41 /// Fire PostToolUse hook event after tool execution (fire-and-forget).
42 pub(super) async fn fire_post_tool_use(
43 &self,
44 session_id: &str,
45 tool_name: &str,
46 args: &serde_json::Value,
47 output: &str,
48 success: bool,
49 duration_ms: u64,
50 ) {
51 if let Some(he) = &self.config.hook_engine {
52 // Convert null args to empty object so JS callbacks don't get null.input errors
53 let safe_args = if args.is_null() {
54 serde_json::Value::Object(Default::default())
55 } else {
56 args.clone()
57 };
58 let event = HookEvent::PostToolUse(PostToolUseEvent {
59 session_id: session_id.to_string(),
60 tool: tool_name.to_string(),
61 args: safe_args,
62 result: ToolResultData {
63 success,
64 output: output.to_string(),
65 exit_code: if success { Some(0) } else { Some(1) },
66 duration_ms,
67 },
68 });
69 let he = Arc::clone(he);
70 tokio::spawn(async move {
71 let _ = he.fire(&event).await;
72 });
73 }
74 }
75
76 /// Fire PostResponse hook event after the agent loop completes.
77 pub(super) async fn fire_post_response(

Callers 1

complete_tool_callMethod · 0.80

Calls 2

cloneMethod · 0.45
fireMethod · 0.45

Tested by

no test coverage detected