# `Snodo.Context`
[🔗](https://github.com/joshrotenberg/snodo/blob/v0.4.3/lib/snodo/context.ex#L1)

Immutable request-scoped protocol, transport, auth, and tracing context.

MRTR retries are new requests, not suspended handlers. `input_responses`
contains the client's bare input results and `request_state` is untrusted
opaque client input. Use `Snodo.Elicitation.response/3` (or the deprecated
`Snodo.Sampling.response/3` and `Snodo.Roots.response/3`) to consume a named
answer and `Snodo.MRTR.State` to protect state that affects business logic.
`request_method` and `request_params` preserve the incoming operation for
request-bound state verification; tool and prompt arguments remain unchanged.

`dispatch_check` is set by `Snodo.Server` while extension middleware runs; use
it through `Snodo.Extension.check_dispatch/3`.

`trace_context` contains valid W3C `traceparent` and `tracestate` values from
request `_meta` with string keys. When it contains `"traceparent"`, pass it as
a client's `:trace_context` option to forward those values. `metadata`
retains the original request values.

# `t`

```elixir
@type t() :: %Snodo.Context{
  auth: map() | nil,
  cancellation: term() | nil,
  client_capabilities: map(),
  client_info: map() | nil,
  dispatch_check:
    (term(), map(), t() -&gt;
       :ok | {:ok, Snodo.Result.t()} | {:error, Snodo.Error.t()})
    | nil,
  extension_options: %{optional(String.t()) =&gt; keyword() | map()},
  extensions: map(),
  input_responses: map(),
  logging: Snodo.Logging.t() | nil,
  metadata: map(),
  progress: Snodo.Progress.t() | nil,
  protocol: module(),
  protocol_version: String.t(),
  request_id: Snodo.Envelope.id(),
  request_method: String.t() | nil,
  request_params: map(),
  request_state: String.t() | nil,
  server_capabilities: map(),
  server_info: map(),
  session: term() | nil,
  trace_context: Snodo.TraceContext.t(),
  transport: Snodo.Transport.Context.t()
}
```

# `extension_settings`

```elixir
@spec extension_settings(t(), String.t()) :: map() | nil
```

Returns the negotiated settings for extension `id`, or `nil` when the
extension was not negotiated for this request.

For an extension declared with `{:declared, id, settings}` these are the
settings the client sent for `id`, so a handler can tell whether the client
supports the extension and fall back when it does not. For a
`Snodo.Extension` module they are what its `negotiate/2` returned.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
