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

Method handle_tool_use

atomic-agent/src/turn/orchestrator/turn.rs:811–838  ·  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

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