2026-07-20 09:04:57 +07:00
|
|
|
//! Subagent tool helpers — wrap tool execution for subagent use.
|
|
|
|
|
|
|
|
|
|
use anyhow::Result;
|
2026-07-20 15:53:20 +07:00
|
|
|
use tracing::instrument;
|
|
|
|
|
|
|
|
|
|
use crate::tools::{Tool, ToolCtx};
|
2026-07-20 09:04:57 +07:00
|
|
|
|
|
|
|
|
/// Execute a single tool call within a subagent context.
|
2026-07-20 15:53:20 +07:00
|
|
|
///
|
|
|
|
|
/// Delegates directly to the tool's `run` method with the given context and
|
|
|
|
|
/// JSON arguments.
|
|
|
|
|
#[instrument(skip(tool, ctx, args))]
|
2026-07-20 09:04:57 +07:00
|
|
|
pub fn execute_tool_call(
|
|
|
|
|
tool: &dyn Tool,
|
|
|
|
|
ctx: &ToolCtx,
|
|
|
|
|
args: &serde_json::Value,
|
|
|
|
|
) -> Result<String> {
|
|
|
|
|
tool.run(ctx, args)
|
|
|
|
|
}
|