pub trait Command:
Send
+ Sync
+ 'static {
// Required methods
fn spec(&self) -> &CommandSpec;
fn run<'life0, 'async_trait>(
&'life0 self,
app: App,
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn subcommand_passthrough(&self) -> bool { ... }
fn mcp_exposed(&self) -> bool { ... }
fn mcp_input_schema(&self) -> Option<Value> { ... }
}Expand description
The contract every CLI subcommand implements.
Implementations are typically registered via the
BUILTIN_COMMANDS distributed slice. rtb-cli provides a
#[rtb::command] attribute macro that derives the boilerplate for
downstream tools; hand-written impls follow the example in the
module docs.
Required Methods§
Sourcefn spec(&self) -> &CommandSpec
fn spec(&self) -> &CommandSpec
The command’s static descriptor.
Provided Methods§
Sourcefn subcommand_passthrough(&self) -> bool
fn subcommand_passthrough(&self) -> bool
When true, rtb-cli’s top-level clap parser passes every
argument after <name> through to Self::run without
further validation. Commands that own their own clap subtree
(e.g. docs list / show / browse / serve, update check / run)
opt into this so the inner parser can produce its own help
and error messages.
Defaults to false — most commands let the framework reject
unknown args at the outer layer.
Sourcefn mcp_exposed(&self) -> bool
fn mcp_exposed(&self) -> bool
When true, this command is registered as an MCP tool by
rtb_mcp::McpServer. Defaults to false — additive trait
method, no impact on existing impls.
Sourcefn mcp_input_schema(&self) -> Option<Value>
fn mcp_input_schema(&self) -> Option<Value>
Optional JSON Schema for the command’s arguments — surfaced
to MCP clients in the tool listing. Default: None. Tool
authors with clap::Args structs typically derive this via
serde_json::to_value(schemars::schema_for!(MyArgs)).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".