//! Handler for `mcptest mock --tools-from <PATH>`.

use anyhow::{anyhow, Result};
use mcptest_mcp_server::fault::Fault;

use crate::cli::args::MockArgs;
use crate::cli::GlobalArgs;
use crate::commands;

/// Handle `mcptest mock --tools-from <PATH> [--fault <kind>]` (,
/// ).
pub(crate) fn mock_command(global: &GlobalArgs, args: MockArgs) -> Result<i32> {
    let fault = Fault::parse(&args.fault).map_err(|e| anyhow!("invalid --fault: {e}"))?;
    commands::run_mock(commands::MockRunArgs {
        tools_from: args.tools_from,
        preset: args.preset,
        quiet: global.quiet,
        fault,
    })
}
