use thiserror::Error;
#[derive(Error, Debug)]
#[allow(dead_code)]
pub enum McpError {
#[error("Configuration error: {0}")]
Configuration(String),
#[error("Cloud API error: {0}")]
CloudApi(String),
#[error("Enterprise API error: {0}")]
EnterpriseApi(String),
#[error("Redis error: {0}")]
Redis(String),
#[error("Authentication error: {0}")]
Auth(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_core::ConfigError> for McpError {
fn from(err: redisctl_core::ConfigError) -> Self {
McpError::Configuration(err.to_string())
}
}
#[cfg(feature = "database")]
impl From<redis::RedisError> for McpError {
fn from(err: redis::RedisError) -> Self {
McpError::Redis(err.to_string())
}
}