pub async fn run(
from_config: Option<String>,
server: Option<String>,
args: Vec<String>,
env: Vec<String>,
cwd: Option<String>,
http: Option<String>,
sse: Option<String>,
headers: Vec<String>,
detailed: bool,
output_format: OutputFormat,
) -> Result<ExitCode>Expand description
Runs the introspect command.
Connects to the specified server, discovers its tools, and displays information according to the output format.
§Process
- Builds
ServerConfigfrom CLI arguments or loads from ~/.claude/mcp.json - Creates an introspector and connects to the server
- Discovers server capabilities and tools
- Formats the output according to the specified format
- Displays the results to stdout
§Arguments
from_config- Load server config from ~/.claude/mcp.json by nameserver- Server command (binary name or path), None for HTTP/SSEargs- Arguments to pass to the server commandenv- Environment variables in KEY=VALUE formatcwd- Working directory for the server processhttp- HTTP transport URLsse- SSE transport URLheaders- HTTP headers in KEY=VALUE formatdetailed- Whether to show detailed tool schemasoutput_format- Output format (json, text, pretty)
§Errors
Returns an error if:
- Server configuration is invalid
- Server connection fails
- Server introspection fails
- Output formatting fails
§Examples
use mcp_execution_cli::commands::introspect;
use mcp_execution_core::cli::OutputFormat;
// Simple server
let exit_code = introspect::run(
None,
Some("github-mcp-server".to_string()),
vec!["stdio".to_string()],
vec![],
None,
None,
None,
vec![],
false,
OutputFormat::Json
).await?;
// HTTP transport
let exit_code = introspect::run(
None,
None,
vec![],
vec![],
None,
Some("https://api.githubcopilot.com/mcp/".to_string()),
None,
vec!["Authorization=Bearer token".to_string()],
false,
OutputFormat::Json
).await?;