use anyhow::Result;
use crate::client::support::{CheckArgs, DetectArgs};
pub async fn run_check_command(args: CheckArgs, _verbose: bool, quiet: bool) -> Result<()> {
if !quiet {
eprintln!("Checking service health: {}", &args.url);
}
match crate::client::protocol::detect_mcp_protocol(&args.url).await {
Ok(protocol) => {
if !quiet {
eprintln!("Service is healthy (protocol: {protocol})");
}
Ok(())
}
Err(e) => {
if !quiet {
eprintln!("Service check failed: {e}");
}
Err(e)
}
}
}
pub async fn run_detect_command(args: DetectArgs, _verbose: bool, quiet: bool) -> Result<()> {
let protocol = crate::client::protocol::detect_mcp_protocol(&args.url).await?;
if quiet {
println!("{}", protocol);
} else {
eprintln!("{}", protocol);
}
Ok(())
}