pub async fn run_tool(
state: &Arc<ServerState>,
tracker: &Arc<ReadTracker>,
caps: &Arc<CapabilitySet>,
caller_id: Option<&str>,
tool_id: String,
args: Value,
dry_run: bool,
) -> ResponseExpand description
Execute one RunTool request against the shared dispatch state.
Single-entry-point for both transports: UDS goes through
dispatch_request which forwards Request::RunTool here; HTTP
(atd-server-http::mcp::tools_call) calls this fn directly. The
emitted Response is the same enum + same JSON encoding on either
route — Response::ToolResultResponse on success / execution-failed,
Response::Error on capability-denied / rate-limited / broker error /
tool-not-found / invalid args / internal error.
The body is the verbatim move of the SP-streamable-http §6.3
atd-server::connection.rs::dispatch RunTool arm — every audit
emission, capability check, semaphore acquire, broker call, binding
dispatch, middleware step, and error map is preserved. The existing
atd-server::connection::tests suite covers all branches and is
re-routed through this fn unchanged after refactor.