Skip to main content

run

Function run 

Source
pub async fn run(
    server: String,
    servers_dir: Option<PathBuf>,
    output_path: Option<PathBuf>,
    skill_name: Option<String>,
    hints: Vec<String>,
    overwrite: bool,
    output_format: OutputFormat,
) -> Result<ExitCode>
Expand description

Runs the skill command.

Scans generated progressive loading TypeScript files and prepares context for generating a Claude Code instruction skill (SKILL.md).

§Process

  1. Validates server ID format
  2. Determines servers directory (default: ~/.claude/servers)
  3. Validates path security (no symlink escape)
  4. Scans TypeScript files in {servers_dir}/{server}/
  5. Builds skill generation context
  6. Returns structured output with generation prompt

§Arguments

  • server - Server identifier (e.g., “github”)
  • servers_dir - Base directory for generated servers (default: ~/.claude/servers)
  • output_path - Custom output path for SKILL.md (default: ~/.claude/skills/{server}/SKILL.md)
  • skill_name - Custom skill name (default: {server}-progressive)
  • hints - Use case hints for skill generation
  • overwrite - Whether to overwrite existing SKILL.md file
  • output_format - Output format (json, text, pretty)

§Errors

Returns an error if:

  • Server ID format is invalid
  • Servers directory does not exist
  • Server subdirectory does not exist
  • Path traversal detected
  • TypeScript files cannot be scanned

§Examples

use mcp_execution_cli::commands::skill;
use mcp_execution_core::cli::OutputFormat;

// Generate skill for GitHub server
let exit_code = skill::run(
    "github".to_string(),
    None,
    None,
    None,
    vec![],
    false,
    OutputFormat::Json
).await?;