use thiserror::Error;
#[derive(Error, Debug)]
pub enum ToolError {
#[error("Tool not found: {0}")]
NotFound(String),
#[error("Failed to generate schema for tool '{0}': {1}")]
SchemaGenerationError(String, serde_json::Error),
#[error("Failed to parse arguments for tool '{0}': {1}")]
ArgumentParsingError(String, serde_json::Error),
#[error("Invalid arguments for tool: {0}")]
InvalidArguments(String),
#[error("Tool execution failed: {0}")]
ExecutionError(String),
#[error("Type mismatch after execution for tool '{0}': Expected different output type")]
OutputTypeMismatch(String),
}
#[derive(Error, Debug)]
pub enum Error {
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("HTTP request error: {0}")]
Request(#[from] reqwest::Error),
#[error("Couldn't parse base url")]
BaseUrlError(#[from] url::ParseError),
#[error("Rate limit exceeded: {0}")]
RateLimit(String),
#[error("Authentication error: {0}")]
Authentication(String),
#[error("Model not supported: {0}")]
UnsupportedModel(String),
#[error("Provider not available: {0}")]
ProviderUnavailable(String),
#[error("Context length exceeded: {0}")]
ContextLengthExceeded(String),
#[error("Tool not found: {0}")]
ToolNotFound(String),
#[error("Invalid tool parameter: {0}")]
InvalidToolParameter(String),
#[error("Invalid tool arguments: {0}")]
InvalidToolArguments(String),
#[error("Tool execution error: {0}")]
ToolExecutionError(String),
#[error("Tool error: {0}")]
Tool(#[from] ToolError),
#[error("Provider feature not supported: {0}")]
ProviderFeatureNotSupported(String),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, Error>;