MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / handle_tool_use

Method handle_tool_use

atomic-agent/src/turn/orchestrator/turn.rs:803–830  ·  view source on GitHub ↗

Handle a PreToolUse or PostToolUse event. Currently tracks tool usage for informational purposes. Future enhancements may create sub-turn recordings for sub-agent (Task) tools.

(
        &mut self,
        event: TurnEvent,
    )

Source from the content-addressed store, hash-verified

801 /// Currently tracks tool usage for informational purposes. Future
802 /// enhancements may create sub-turn recordings for sub-agent (Task) tools.
803 pub(super) async fn handle_tool_use(
804 &mut self,
805 event: TurnEvent,
806 ) -> AgentResult<DispatchResult> {
807 let session_id = &event.session_id;
808
809 let session = self.load_or_create_session(session_id, &event)?;
810 let turn_number = session.turn_count.saturating_add(1);
811 self.commit_hook_event(&event, turn_number)?;
812
813 // Log tool usage
814 if let Some(ref tool_name) = event.tool_name {
815 log::info!(
816 "Session {} tool use: {} ({})",
817 session_id,
818 tool_name,
819 event.event_type,
820 );
821 }
822
823 // CB-13D: surface a pending shim-watch notice before the agent's
824 // next tool call executes (RFC §11.2 rule 6).
825 let mut dispatch = DispatchResult::new(session_id, session.phase);
826 if let Some(warning) = drain_watch_notice(self, session_id) {
827 dispatch = dispatch.with_warning(warning);
828 }
829 Ok(dispatch)
830 }
831
832 fn wait_turn_publication_lock(
833 &self,

Callers 1

dispatchMethod · 0.80

Calls 4

drain_watch_noticeFunction · 0.85
commit_hook_eventMethod · 0.80
with_warningMethod · 0.45

Tested by

no test coverage detected