class

MCP::Shared::RequestHandlerExtra

Inherits JSON::Serializable::Unmapped < Reference < Object

Constructors

Instance methods

cancel_channel
Source
cancel_channel=(cancel_channel : Channel(Bool) | Nil)
Source
cancelled?

Check whether the request was cancelled by the client.

Source
extensions
Source
extensions=(extensions : Hash(String, JSON::Any))
Source
get_extension(key : String, t : T.class) : T | Nil forall T

Retrieve a typed value by key, deserializing from JSON. Returns nil if the key is missing or the value doesn't match T.

trace = extra.get_extension("trace_id", TraceContext)
Source
set_extension(key : String, value)

Store a typed value in the extensions map, serialized as JSON. Use in request handlers to attach per-request context.

extra.set_extension("trace_id", some_struct)
Source