Public declaration syntax from forge-rs/crates/forge-mcp/src/error.rs Original source SHA-256: 7aa2b1da0f4e840c1ce332be1be9af09ca02613b18ff07b3a63e804a98047a4e Function bodies and constant values are omitted. This is not the complete implementation. Source line 40 #[derive(Debug, Error)] pub enum ForgeMcpError { /// Failed to establish a connection to an MCP server. /// /// Check that the server is running, the transport configuration is correct, /// and the endpoint is reachable. #[error("MCP connection to '{endpoint}' failed: {reason}")] ConnectionFailed { /// The endpoint that was being connected to. endpoint: String, /// What went wrong during connection. reason: String, }, /// A transport-level I/O error occurred. /// /// This covers read/write failures on the underlying transport (stdio, SSE, HTTP). #[error("MCP transport error on '{transport}': {reason}")] TransportError { /// The transport type (e.g., "stdio", "sse", "http"). transport: String, /// Description of the I/O failure. reason: String, }, /// The MCP protocol exchange contained invalid framing or unexpected content. /// /// This indicates a JSON-RPC framing error, an unrecognized method, or a /// protocol version mismatch. #[error("MCP protocol error (code={code}): {message}")] ProtocolError { /// The JSON-RPC error code, or -1 if not applicable. code: i64, /// Description of the protocol-level failure. message: String, }, /// The requested tool was not found on the MCP server. /// /// Check the tool name spelling and call `list_tools()` to see available tools. #[error("MCP tool '{tool_name}' not found; available tools: {}", available.join(", "))] ToolNotFound { /// The tool name that was looked up. tool_name: String, /// The tools that are actually available. available: Vec, }, /// JSON serialization or deserialization of an MCP message failed. #[error("MCP serialization error: {reason}")] SerializationError { /// What went wrong during serialization. reason: String, }, /// Authentication or authorization failed for the MCP connection. /// /// Check OAuth configuration, client credentials, and token validity. #[error("MCP auth error for endpoint '{endpoint}': {reason}")] AuthError { /// The endpoint that rejected authentication. endpoint: String, /// Why authentication failed. reason: String, }, /// An error propagated from the Forge core layer. #[error("Forge core error: {0}")] Core(#[from] ForgeError), } Source line 111 pub type ForgeMcpResult = Result;