Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Process-global switches controlling plaintext-vs-redacted diagnostics. Process-global diagnostic-exposure switches.

Several types in this crate carry material that must never reach logs by accident: OAuth access tokens, JWT claim values, and MCP tool-call arguments. Their Debug implementations and the corresponding tracing call sites therefore redact by default.

Redaction is nevertheless a debugging obstacle, so each category can be switched to plaintext. Debug::fmt receives only &self and a formatter – it cannot see an ObservabilityConfig – so the switches live here as process-global atomics rather than as per-server state.

§⚠️ These switches are process-wide, not per-server

A process hosting more than one rmcp-server-kit server shares one set of switches. Enabling a switch for one server enables it for every rmcp-server-kit Debug output and gated log site in the process. There is deliberately no per-server override: a Debug impl has no request or server context to key off.

§⚠️ Enabling a switch writes secrets to your logs

Every switch defaults to the safe (redacted) state and is intended for short-lived local debugging. Never enable one in production.

§Setting the switches

Consumers loading TOML get this for free: the three observability.log_* keys are applied by init_tracing_from_config_strict. Builder-only consumers that never touch TOML can call set_diagnostic_exposure directly.

use rmcp_server_kit::diagnostics::{DiagnosticExposure, set_diagnostic_exposure};

// Default is fully redacted.
let exposure = DiagnosticExposure::default();
set_diagnostic_exposure(&exposure);

Structs§

DiagnosticExposure
Which categories of sensitive material may be rendered in plaintext.

Functions§

set_diagnostic_exposure
Apply exposure to the process-global diagnostic switches.