reagent_rs/tools/
errors.rs

1/// Errors that can occur during execution of a tool.
2///
3/// These errors indicate failures in parsing arguments, actually
4/// running the tool, or locating the requested tool.
5#[derive(Debug)]
6pub enum ToolExecutionError {
7    /// The provided arguments could not be parsed or were invalid.
8    ArgumentParsingError(String),
9    /// The tool failed during execution (runtime failure inside the tool).
10    ExecutionFailed(String),
11    /// The requested tool was not found in the agent’s registry.
12    ToolNotFound(String),
13}
14
15
16impl std::fmt::Display for ToolExecutionError {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        match self {
19            ToolExecutionError::ArgumentParsingError(s) => write!(f, "Tool argument parsing error: {s}"),
20            ToolExecutionError::ExecutionFailed(s) => write!(f, "Tool execution failed: {s}"),
21            ToolExecutionError::ToolNotFound(s) => write!(f, "Tool not found: {s}"),
22        }
23    }
24}
25
26impl std::error::Error for ToolExecutionError {}