//! Tool trait definition
use async_trait::async_trait;
use serde_json::Value;
use std::sync::Arc;
/// Tool trait - all tools implement this
#[async_trait]
pub trait Tool: Send + Sync {
/// Tool name
fn name(&self) -> &str;
/// Tool description
fn description(&self) -> &str;
/// JSON schema for tool parameters
fn parameters_schema(&self) -> Value {
serde_json::json!({})
}
/// Whether this tool requires network access.
/// Default is `true` (conservative).
/// Override to `false` for local-only tools (e.g., file, calculator).
fn requires_network(&self) -> bool {
true
}
/// Execute the tool with the given arguments
async fn execute(&self, args: Value) -> anyhow::Result<Value>;
}
/// Boxed tool for dynamic dispatch
pub type DynTool = Arc<dyn Tool>;