Expand description
§mtp-sdk
Make any Clap-based CLI tool LLM-discoverable with --mtp-describe.
This crate reads type information, help strings, defaults, and possible
values directly from Clap’s Command and Arg metadata, so you get
--mtp-describe with zero extra annotation in most cases.
§Quick start
use clap::Parser;
use mtp_sdk::Describable;
#[derive(Parser)]
#[command(name = "mytool", version = "1.0.0", about = "Does things")]
struct Cli {
/// Input file
input: String,
}
fn main() {
let cli = Cli::describable();
}Structs§
- ArgDescriptor
- Describes a single argument (positional or flag).
- Auth
Config - Tool-level auth configuration.
- Auth
Provider - A supported authentication provider.
- Command
Annotation - Annotations for a single command (examples, IO, auth).
- Command
Auth - Per-command auth overrides.
- Command
Descriptor - A single (leaf) command in the tool.
- Describable
Builder - Builder for attaching examples, IO descriptors, and auth config
to commands before checking
--mtp-describe. - Describe
Options - Options passed to
describe()for attaching metadata. - Example
- An example invocation.
- IODescriptor
- Describes stdin or stdout for a command.
- Tool
Schema - Top-level tool schema returned by
--mtp-describe.
Constants§
- MTP_
SPEC_ VERSION - The MTP specification version this SDK implements.
Traits§
- Describable
- Trait for Clap-derived CLI structs to add
--mtp-describesupport.
Functions§
- describe
- Extract the full
ToolSchemafrom a ClapCommand. - extract_
arg - Extract an
ArgDescriptorfrom a ClapArg. ReturnsNonefor hidden args. - extract_
schema - Extract the full
ToolSchemafrom an already-builtCommand. - infer_
arg_ type - Infer the MTP arg type from a Clap
Arg. - walk_
commands - Recursively walk a
Commandtree, returning leaf commands with space-separated names (e.g. “auth login”). Commands with no visible subcommands are leaves.