Skip to main content

ConsoleConfig

Struct ConsoleConfig 

Source
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: bool

Force plain text mode (no styling)

§show_banner: bool

Show startup banner

§show_capabilities: bool

Ask the host’s banner renderer to include its capabilities list.

ConsoleConfig stores this integration setting but does not itself render banners.

§banner_style: BannerStyle

Banner display style

§log_level: LevelFilter

Maximum enabled log verbosity for the host’s logging integration.

§log_timestamps: bool

Ask the host’s logging integration to show timestamps.

§log_targets: bool

Ask the host’s logging integration to show target modules.

§log_file_line: bool

Ask the host’s logging integration to show source file and line.

§traffic_verbosity: TrafficVerbosity

Traffic logging verbosity. TrafficVerbosity::None disables traffic rendering entirely.

§show_suggestions: bool

Show fix suggestions for errors

§show_error_codes: bool

Show error codes

§show_backtrace: bool

Show 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: usize

Maximum rows in tables

§max_json_depth: usize

Maximum JSON depth admitted for traffic previews before omission.

§truncate_at: usize

Truncate long strings at this length

Implementations§

Source§

impl ConsoleConfig

Source

pub fn new() -> Self

Create config with defaults

Source

pub fn from_env() -> Self

Create config from environment variables

§Environment Variables
VariableValuesDescription
FASTMCP_FORCE_COLOR(set)Force rich output
FASTMCP_PLAIN(set)Force plain output
NO_COLOR(set)Disable colors (standard)
FASTMCP_BANNERfull/compact/minimal/noneBanner style
FASTMCP_NO_BANNER1/true/yesDisable the banner
FASTMCP_LOGoff/trace/debug/info/warn/errorLog level
FASTMCP_LOG_TIMESTAMPS0/1Show timestamps
FASTMCP_LOG_TARGETS0/1Show target modules
FASTMCP_LOG_FILE_LINE0/1Show source file and line
FASTMCP_TRAFFICnone/summary/fullTraffic logging
RUST_BACKTRACE1/fullShow backtraces
Source

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.

Source

pub fn plain_mode(self) -> Self

Enable plain text mode (no styling)

Source

pub fn with_banner(self, style: BannerStyle) -> Self

Set the banner style

Source

pub fn without_banner(self) -> Self

Disable the banner entirely

Source

pub fn with_log_level(self, level: Level) -> Self

Set the log level

Source

pub fn with_log_level_filter(self, level: LevelFilter) -> Self

Set the log level from a filter, including log::LevelFilter::Off.

Source

pub fn with_traffic(self, verbosity: TrafficVerbosity) -> Self

Set traffic logging verbosity

Source

pub fn without_suggestions(self) -> Self

Disable fix suggestions for errors

Source

pub fn with_context(self, context: DisplayContext) -> Self

Set display context explicitly

Source

pub fn with_max_table_rows(self, max: usize) -> Self

Set maximum table rows

Source

pub fn with_max_json_depth(self, max: usize) -> Self

Set the maximum JSON depth admitted for traffic previews.

Source

pub fn with_truncate_at(self, len: usize) -> Self

Set truncation length

Source

pub fn theme(&self) -> &'static FastMcpTheme

Get the theme (uses global theme singleton)

Source

pub fn resolve_context(&self) -> DisplayContext

Resolve the display context based on config and environment

Source

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

Source§

fn clone(&self) -> ConsoleConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConsoleConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConsoleConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more