use thiserror::Error;
#[derive(Debug, Error)]
pub enum McpError {
#[error(
"MCP server {server:?} is not trusted — run `oxi mcp trust {server}` to allow, \
or remove the entry from mcp.json if you did not configure it"
)]
ConsentDenied {
server: String,
},
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn consent_denied_display_names_server_and_command() {
let e = McpError::ConsentDenied {
server: "github".to_string(),
};
let msg = format!("{e}");
assert!(msg.contains("github"), "message must name the server");
assert!(
msg.contains("oxi mcp trust github"),
"message must surface the exact remediation command, got: {msg}"
);
}
#[test]
fn consent_denied_is_send_and_sync() {
fn assert_send_sync<T: Send + Sync + 'static>() {}
assert_send_sync::<McpError>();
}
}