pub struct ConsoleConfig {Show 17 fields
pub context: Option<DisplayContext>,
pub force_color: Option<bool>,
pub force_plain: bool,
pub show_banner: bool,
pub show_capabilities: bool,
pub banner_style: BannerStyle,
pub log_level: LevelFilter,
pub log_timestamps: bool,
pub log_targets: bool,
pub log_file_line: bool,
pub traffic_verbosity: TrafficVerbosity,
pub show_suggestions: bool,
pub show_error_codes: bool,
pub show_backtrace: bool,
pub max_table_rows: usize,
pub max_json_depth: usize,
pub truncate_at: usize,
}Expand description
Shared configuration for FastMCP console output and host integrations.
Fields§
§context: Option<DisplayContext>Override display context (None = auto-detect)
force_color: Option<bool>Explicit color-mode override (true = rich, false = plain).
None leaves the decision to Self::context or environment
detection.
force_plain: boolForce plain text mode (no styling)
Show startup banner
show_capabilities: boolAsk the host’s banner renderer to include its capabilities list.
ConsoleConfig stores this integration setting but does not itself
render banners.
Banner display style
log_level: LevelFilterMaximum enabled log verbosity for the host’s logging integration.
log_timestamps: boolAsk the host’s logging integration to show timestamps.
log_targets: boolAsk the host’s logging integration to show target modules.
log_file_line: boolAsk the host’s logging integration to show source file and line.
traffic_verbosity: TrafficVerbosityTraffic logging verbosity. TrafficVerbosity::None disables traffic
rendering entirely.
show_suggestions: boolShow fix suggestions for errors
show_error_codes: boolShow error codes
show_backtrace: boolShow explicitly captured panic backtraces.
Ordinary fastmcp_core::McpError values do not carry a captured
backtrace, so this setting neither captures nor synthesizes one. It is
honored by RichErrorRenderer::from_config when a backtrace is passed
to RichErrorRenderer::render_panic.
max_table_rows: usizeMaximum rows in tables
max_json_depth: usizeMaximum JSON depth admitted for traffic previews before omission.
truncate_at: usizeTruncate long strings at this length
Implementations§
Source§impl ConsoleConfig
impl ConsoleConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create config from environment variables
§Environment Variables
| Variable | Values | Description |
|---|---|---|
FASTMCP_FORCE_COLOR | (set) | Force rich output |
FASTMCP_PLAIN | (set) | Force plain output |
NO_COLOR | (set) | Disable colors (standard) |
FASTMCP_BANNER | full/compact/minimal/none | Banner style |
FASTMCP_NO_BANNER | 1/true/yes | Disable the banner |
FASTMCP_LOG | off/trace/debug/info/warn/error | Log level |
FASTMCP_LOG_TIMESTAMPS | 0/1 | Show timestamps |
FASTMCP_LOG_TARGETS | 0/1 | Show target modules |
FASTMCP_LOG_FILE_LINE | 0/1 | Show source file and line |
FASTMCP_TRAFFIC | none/summary/full | Traffic logging |
RUST_BACKTRACE | 1/full | Show backtraces |
Sourcepub fn force_color(self, force: bool) -> Self
pub fn force_color(self, force: bool) -> Self
Set an explicit color-mode override.
Passing true forces rich output, including for non-TTY destinations.
Passing false forces plain output. Leave Self::force_color as
None to use the configured context or automatic detection.
Sourcepub fn plain_mode(self) -> Self
pub fn plain_mode(self) -> Self
Enable plain text mode (no styling)
Set the banner style
Disable the banner entirely
Sourcepub fn with_log_level(self, level: Level) -> Self
pub fn with_log_level(self, level: Level) -> Self
Set the log level
Sourcepub fn with_log_level_filter(self, level: LevelFilter) -> Self
pub fn with_log_level_filter(self, level: LevelFilter) -> Self
Set the log level from a filter, including log::LevelFilter::Off.
Sourcepub fn with_traffic(self, verbosity: TrafficVerbosity) -> Self
pub fn with_traffic(self, verbosity: TrafficVerbosity) -> Self
Set traffic logging verbosity
Sourcepub fn without_suggestions(self) -> Self
pub fn without_suggestions(self) -> Self
Disable fix suggestions for errors
Sourcepub fn with_context(self, context: DisplayContext) -> Self
pub fn with_context(self, context: DisplayContext) -> Self
Set display context explicitly
Sourcepub fn with_max_table_rows(self, max: usize) -> Self
pub fn with_max_table_rows(self, max: usize) -> Self
Set maximum table rows
Sourcepub fn with_max_json_depth(self, max: usize) -> Self
pub fn with_max_json_depth(self, max: usize) -> Self
Set the maximum JSON depth admitted for traffic previews.
Sourcepub fn with_truncate_at(self, len: usize) -> Self
pub fn with_truncate_at(self, len: usize) -> Self
Set truncation length
Sourcepub fn theme(&self) -> &'static FastMcpTheme
pub fn theme(&self) -> &'static FastMcpTheme
Get the theme (uses global theme singleton)
Sourcepub fn resolve_context(&self) -> DisplayContext
pub fn resolve_context(&self) -> DisplayContext
Resolve the display context based on config and environment
Sourcepub fn should_use_rich(&self) -> bool
pub fn should_use_rich(&self) -> bool
Check if rich output should be used based on resolved context
Trait Implementations§
Source§impl Clone for ConsoleConfig
impl Clone for ConsoleConfig
Source§fn clone(&self) -> ConsoleConfig
fn clone(&self) -> ConsoleConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more