use thiserror::Error;
#[derive(Error, Debug)]
pub enum McpError {
#[error("Configuration error: {0}")]
Configuration(String),
#[error("Cloud API error: {0}")]
CloudApi(String),
#[error("Enterprise API error: {0}")]
EnterpriseApi(String),
#[error("Tool execution error: {0}")]
ToolExecution(String),
#[error("Invalid parameters: {0}")]
InvalidParameters(String),
#[error("Operation not permitted: server is in read-only mode")]
ReadOnlyMode,
}
impl From<anyhow::Error> for McpError {
fn from(err: anyhow::Error) -> Self {
McpError::ToolExecution(err.to_string())
}
}
impl From<redisctl_config::ConfigError> for McpError {
fn from(err: redisctl_config::ConfigError) -> Self {
McpError::Configuration(err.to_string())
}
}