erio_tools/tool.rs
1//! Tool trait definition.
2
3use crate::result::ToolResult;
4use crate::schema::ToolSchema;
5use erio_core::ToolError;
6use serde_json::Value;
7
8/// A tool that can be executed by an agent.
9#[async_trait::async_trait]
10pub trait Tool: Send + Sync {
11 /// Returns the unique name of this tool.
12 fn name(&self) -> &str;
13
14 /// Returns a human-readable description of what this tool does.
15 fn description(&self) -> &str;
16
17 /// Returns the JSON Schema describing the tool's parameters.
18 fn schema(&self) -> ToolSchema;
19
20 /// Executes the tool with the given parameters.
21 async fn execute(&self, params: Value) -> Result<ToolResult, ToolError>;
22}