Access to the validated context of the currently executing server callback.
This is primarily useful for MRTR-aware handlers that retain their existing callback arity. The value is scoped to the callback invocation and must not be read later from a spawned process.
Summary
Functions
Reports progress for the currently executing request callback.
Sends a log notification on the currently executing request's HTTP stream.
Functions
@spec current() :: ExMCP.Server.RequestContext.t() | nil
@spec input_responses() :: map() | nil
@spec progress_token() :: ExMCP.Types.progress_token() | nil
@spec report_progress(number(), number() | nil, String.t() | nil) :: :ok | {:error, :no_request_context | :progress_not_requested | :request_not_streaming | :stream_closed | :stream_timeout}
Reports progress for the currently executing request callback.
Modern streamable-HTTP handlers use this request-scoped helper instead of a
connection-wide server process. The request must include
_meta.progressToken, and its HTTP response must be an active SSE stream.
Delivery is acknowledged before this function returns, which guarantees the
notification is written before the request's final JSON-RPC response.
@spec request_state() :: term()
@spec send_log_message(atom() | String.t(), String.t(), map()) :: :ok | {:error, :no_request_context | :logging_not_requested | :invalid_log_level | :request_not_streaming | :stream_closed | :stream_timeout}
Sends a log notification on the currently executing request's HTTP stream.
Request-scoped log delivery is available only while that request owns an active SSE response. It never falls back to another request or subscription stream.
MCP protocol Logging is deprecated as of 2026-07-28 and retained throughout ExMCP 1.x. Prefer stderr for stdio diagnostics or OpenTelemetry for new structured-observability integrations.