pub enum CancellationWireMessage {
Legacy2024 {
sender: CancellationSender,
params: CancelledParams,
},
Modern2026 {
sender: CancellationSender,
params: FinalCancelledNotificationParams,
},
}Expand description
An era-selected notifications/cancelled JSON-RPC notification.
This is intentionally separate from the broad ClientNotification and
ServerNotification unions. Those unions preserve schema-open final
extension members for generic routing. This codec is the boundary at which
FastMCP assigns cancellation semantics without inferring meaning from
schema-open extension members.
The codec is for JSON-RPC transports such as stdio. Modern Streamable HTTP
cancellation is a response-stream close and must not be translated into a
second notifications/cancelled POST by a transport integration.
Variants§
Legacy2024
Exact MCP 2024-11-05 cancellation parameters.
Fields
sender: CancellationSenderPeer that originated the notification.
params: CancelledParamsClosed legacy cancellation payload.
Modern2026
MCP 2026-07-28 cancellation parameters.
Notification metadata is optional for either sender and is never synthesized by this codec.
Fields
sender: CancellationSenderPeer that originated the notification.
params: FinalCancelledNotificationParamsFinal cancellation payload.
Implementations§
Source§impl CancellationWireMessage
impl CancellationWireMessage
Sourcepub fn decode(
era: ProtocolEra,
sender: CancellationSender,
request: &JsonRpcRequest,
) -> Result<Self, CancellationWireCodecError>
pub fn decode( era: ProtocolEra, sender: CancellationSender, request: &JsonRpcRequest, ) -> Result<Self, CancellationWireCodecError>
Decodes one cancellation notification using the already-negotiated era and the peer that supplied the frame.
This method deliberately does not infer an era from optional fields. The caller must negotiate once before decoding control traffic.
Sourcepub const fn era(&self) -> ProtocolEra
pub const fn era(&self) -> ProtocolEra
Returns the exact selected protocol era.
Sourcepub const fn sender(&self) -> CancellationSender
pub const fn sender(&self) -> CancellationSender
Returns the peer that originated this cancellation notification.
Sourcepub fn encode(&self) -> Result<JsonRpcRequest, CancellationWireCodecError>
pub fn encode(&self) -> Result<JsonRpcRequest, CancellationWireCodecError>
Encodes this typed cancellation as an ID-free JSON-RPC notification.
Local construction receives the same era-specific validation as peer ingress. A schema-open extension never acquires cancellation semantics through this codec.
Trait Implementations§
Source§impl Clone for CancellationWireMessage
impl Clone for CancellationWireMessage
Source§fn clone(&self) -> CancellationWireMessage
fn clone(&self) -> CancellationWireMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more