Skip to main content

agent_runtime/tool/
dispatcher.rs

1//! Interface for resolving tool metadata and dispatching executions.
2
3use crate::{ToolContext, ToolDefinition, ToolError};
4use async_trait::async_trait;
5use serde_json::Value;
6
7/// Executes tools requested by the model.
8#[async_trait]
9pub trait ToolDispatcher: Send + Sync {
10    fn definition(&self, name: &str) -> Option<ToolDefinition>;
11    async fn execute(
12        &self,
13        context: &ToolContext,
14        name: &str,
15        arguments: Value,
16    ) -> Result<String, ToolError>;
17}