Blocks #31 — the collector documentation describes correlating guard
records with client traces, which needs this field populated to be true.
The audit event schema already carries a trace field (TraceContext —
trace_id + span_id), but nothing ever populates it: every record is written
without one. That leaves the audit log correlatable only by timestamp and
session id when it is read next to a client's own traces.
MCP carries trace context in a request's params._meta (SEP-414), and clients
that are instrumented for distributed tracing already send it. Extracting it is
enough to join a guard record to the client operation that caused it.
Proposal
- Parse
traceparent (and tracestate, if we keep it) out of params._meta
on each request and put the ids into the record's existing trace field.
- Treat the value as untrusted input: validate the format, and record nothing
rather than recording a malformed or oversized value.
- No change to the response path — this is record enrichment only, so
responses stay byte-identical (I15).
Acceptance criteria
See also #34 §4(d) — 2026-07-28 makes SEP-414 documented convention and adds baggage alongside traceparent/tracestate; unlike traceparent it is not fixed-width, so it needs its own bound or a deliberate skip.
Blocks #31 — the collector documentation describes correlating guard
records with client traces, which needs this field populated to be true.
The audit event schema already carries a
tracefield (TraceContext—trace_id+span_id), but nothing ever populates it: every record is writtenwithout one. That leaves the audit log correlatable only by timestamp and
session id when it is read next to a client's own traces.
MCP carries trace context in a request's
params._meta(SEP-414), and clientsthat are instrumented for distributed tracing already send it. Extracting it is
enough to join a guard record to the client operation that caused it.
Proposal
traceparent(andtracestate, if we keep it) out ofparams._metaon each request and put the ids into the record's existing
tracefield.rather than recording a malformed or oversized value.
responses stay byte-identical (I15).
Acceptance criteria
traceparentproduces a record whosetraceids match it.with no
tracefield and is otherwise unchanged.See also #34 §4(d) — 2026-07-28 makes SEP-414 documented convention and adds
baggagealongsidetraceparent/tracestate; unliketraceparentit is not fixed-width, so it needs its own bound or a deliberate skip.