Skip to main content

McpOutcome

Type Alias McpOutcome 

Source
pub type McpOutcome<T> = Outcome<T, McpError>;
Expand description

Outcome type alias for MCP operations with 4-valued returns.

This is the preferred return type for handler functions as it properly represents all possible states: success, error, cancellation, and panic.

§Mapping to JSON-RPC

OutcomeJSON-RPC Response
Ok(value){"result": value}
Err(McpError){"error": {"code": ..., "message": ...}}
Cancelled{"error": {"code": -32004, "message": "Request cancelled"}}
Panicked{"error": {"code": -32603, "message": "Internal error"}}

Aliased Type§

pub enum McpOutcome<T> {
    Ok(T),
    Err(McpError),
    Cancelled(CancelReason),
    Panicked(PanicPayload),
}

Variants§

§

Ok(T)

Success with a value.

§

Err(McpError)

Application-level error.

§

Cancelled(CancelReason)

The operation was cancelled.

§

Panicked(PanicPayload)

The operation panicked.