gglib_core/ports/mcp_error.rs
1//! MCP service error types.
2//!
3//! This module defines service-level errors for MCP operations.
4
5use thiserror::Error;
6
7use super::McpRepositoryError;
8
9/// Domain-specific errors for MCP service operations.
10///
11/// This error type wraps repository errors and adds service-level failure modes
12/// without leaking infrastructure details (OS process errors, SQL errors, etc.).
13#[derive(Debug, Error)]
14pub enum McpServiceError {
15 /// Repository operation failed.
16 #[error(transparent)]
17 Repository(#[from] McpRepositoryError),
18
19 /// Server process failed to start.
20 #[error("Failed to start MCP server: {0}")]
21 StartFailed(String),
22
23 /// Server process failed to stop.
24 #[error("Failed to stop MCP server: {0}")]
25 StopFailed(String),
26
27 /// Server is not running (e.g., when trying to stop).
28 #[error("MCP server not running: {0}")]
29 NotRunning(String),
30
31 /// Tool invocation failed.
32 #[error("MCP tool error: {0}")]
33 ToolError(String),
34
35 /// Configuration validation error.
36 #[error("Invalid MCP configuration: {0}")]
37 InvalidConfig(String),
38}