ExMCP.Protocol.TraceContext (ex_mcp v1.0.0-rc.8)

Copy Markdown View Source

Validates and bounds W3C trace-context fields carried in MCP _meta.

traceparent and tracestate follow the W3C Trace Context wire grammar. Baggage is bounded before filtering and only explicitly allowlisted baggage keys are propagated. This module handles wire values only; it does not attach them to process-global OpenTelemetry state.

Summary

Functions

Returns the trace-context keys used in MCP metadata.

Validates, bounds, and filters a trace-context map.

Types

error_key()

@type error_key() :: String.t()

Functions

keys()

@spec keys() :: [String.t()]

Returns the trace-context keys used in MCP metadata.

normalize(context)

@spec normalize(map()) :: {:ok, map()} | {:error, error_key()}

Validates, bounds, and filters a trace-context map.