pub struct ServerFlags { /* private fields */ }Expand description
Shared server-selection, transport, and timeout flags for introspect and generate.
Fields are private: the only way to obtain a value of this type is via clap parsing
(#[command(flatten)] on Commands::Introspect/Commands::Generate), which — via the
server_source argument group below — guarantees exactly one of --from-config, the
positional server, --http, or --sse is set before TryFrom<ServerFlags> for ServerSource ever runs. This makes the illegal states (zero or multiple
selectors) unconstructible outside this module rather than merely checked at runtime.
§Examples
use clap::Parser;
use mcp_execution_cli::cli::{Cli, Commands};
// The positional `server` and `--from-config`/`--http`/`--sse` are
// alternative selectors accepted by the same `server_source` group.
let cli = Cli::parse_from(["mcp-execution-cli", "introspect", "github-mcp-server"]);
assert!(matches!(cli.command, Commands::Introspect { .. }));
let cli = Cli::parse_from([
"mcp-execution-cli",
"introspect",
"--http",
"https://api.example.com/mcp",
]);
assert!(matches!(cli.command, Commands::Introspect { .. }));
// Exactly one selector is required: none set is a parse error.
assert!(Cli::try_parse_from(["mcp-execution-cli", "introspect"]).is_err());Trait Implementations§
Source§impl Args for ServerFlags
impl Args for ServerFlags
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Debug for ServerFlags
impl Debug for ServerFlags
Source§impl FromArgMatches for ServerFlags
impl FromArgMatches for ServerFlags
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl TryFrom<ServerFlags> for ServerSource
Converts clap’s parsed ServerFlags landing zone into the closed
ServerSource domain enum.
impl TryFrom<ServerFlags> for ServerSource
Converts clap’s parsed ServerFlags landing zone into the closed
ServerSource domain enum.
§Errors
Returns CoreError::InvalidArgument if none or more than one of
from_config/server/http/sse is set. Unreachable when flags came
from real CLI parsing — the server_source argument group on
ServerFlags already enforces exactly one — but reachable from a
directly-constructed ServerFlags value (e.g. in tests, which can build
one since they are a child module of this one).