Skip to main content
Glama

check_cli_status

Verify which code review CLIs (Codex/OpenAI and Gemini) are installed and available before requesting code reviews to ensure compatibility.

Instructions

Check which code review CLIs (Codex/OpenAI and Gemini) are installed and available. Use this before requesting reviews to see what's available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main execution logic for the 'check_cli_status' tool. Checks CLI availability and returns a formatted Markdown status report.
    private async handleCheckCLIStatus() {
      // Ensure detection has completed
      if (!this.cliAvailability.checked) {
        await this.detectCLIs();
      }
    
      let status = "# CLI Status Check\n\n";
    
      if (this.cliAvailability.codex) {
        status += "✓ **OpenAI CLI (Codex)**: Available\n";
      } else {
        status += "✗ **OpenAI CLI (Codex)**: Not found\n";
        status += "  - Install: `npm install -g openai`\n";
        status += "  - Set API key: `export OPENAI_API_KEY='your-key'`\n";
      }
    
      status += "\n";
    
      if (this.cliAvailability.gemini) {
        status += "✓ **Gemini CLI**: Available\n";
      } else {
        status += "✗ **Gemini CLI**: Not found\n";
        status += "  - See setup instructions in README.md\n";
        status += "  - Set API key: `export GOOGLE_API_KEY='your-key'`\n";
      }
    
      status += "\n";
    
      if (this.cliAvailability.codex && this.cliAvailability.gemini) {
        status += "**Status**: Both review CLIs are available. All features enabled.\n";
      } else if (this.cliAvailability.codex || this.cliAvailability.gemini) {
        status += "**Status**: One review CLI is available. Partial functionality enabled.\n";
      } else {
        status += "**Status**: No review CLIs available. Please install at least one to use reviews.\n";
      }
    
      return {
        content: [
          {
            type: "text",
            text: status,
          },
        ],
      };
    }
  • src/index.ts:178-186 (registration)
    Registers the 'check_cli_status' tool in the tools list returned by ListToolsRequestSchema, including name, description, and input schema.
    {
      name: "check_cli_status",
      description:
        "Check which code review CLIs (Codex/OpenAI and Gemini) are installed and available. Use this before requesting reviews to see what's available.",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:105-106 (registration)
    Dispatches calls to the 'check_cli_status' handler in the CallToolRequestSchema request handler switch statement.
    case "check_cli_status":
      return await this.handleCheckCLIStatus();
  • Helper function called by the handler to detect and set the availability of Codex/OpenAI and Gemini CLI tools.
    private async detectCLIs() {
      console.error("Detecting available CLI tools...");
    
      // Check Codex CLI (codex-cli or openai)
      try {
        const { stdout } = await execAsync("codex --version", { timeout: 5000 });
        if (stdout.includes("codex-cli")) {
          this.cliAvailability.codex = true;
          console.error("✓ Codex CLI detected");
        }
      } catch (error) {
        // Try OpenAI CLI as fallback
        try {
          await execAsync("openai --version", { timeout: 5000 });
          this.cliAvailability.codex = true;
          console.error("✓ OpenAI CLI detected");
        } catch (error2) {
          this.cliAvailability.codex = false;
          console.error("✗ Codex/OpenAI CLI not found");
        }
      }
    
      // Check Gemini CLI
      try {
        await execAsync("gemini --version 2>/dev/null || gemini --help", { timeout: 5000 });
        this.cliAvailability.gemini = true;
        console.error("✓ Gemini CLI detected");
      } catch (error) {
        this.cliAvailability.gemini = false;
        console.error("✗ Gemini CLI not found");
      }
    
      this.cliAvailability.checked = true;
    
      if (!this.cliAvailability.codex && !this.cliAvailability.gemini) {
        console.error("⚠️  Warning: No review CLIs detected. Install OpenAI CLI and/or Gemini CLI to enable reviews.");
      }
    }
  • Defines the input schema for the 'check_cli_status' tool: an empty object (no parameters required).
    inputSchema: {
      type: "object",
      properties: {},
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/je4550/review-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server