1use rmcp::{ErrorData as McpError, model::ErrorCode};
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum Error {
6 #[error("Database error: {0}")]
7 Database(#[from] sqlx::Error),
8
9 #[error("IO error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("Other error: {0}")]
13 Other(String),
14}
15
16pub type Result<T> = std::result::Result<T, Error>;
17
18impl From<Error> for McpError {
19 fn from(error: Error) -> Self {
20 McpError::new(ErrorCode(500), error.to_string(), None)
21 }
22}