Skip to main content
Glama

review_code

Analyze code quality by submitting code for automated review from Codex and Gemini CLIs. Get feedback on security, performance, and best practices to improve your implementation.

Instructions

Request a code review from Codex and Gemini CLIs. Provide code directly as a string. Returns feedback from both reviewers for Claude to consider.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe code to review
contextNoAdditional context about the code (optional)
reviewersNoWhich reviewers to use (default: both)

Implementation Reference

  • The main handler function for the "review_code" MCP tool. It validates input arguments, ensures code is provided, invokes the shared review performance logic, and returns formatted review feedback.
    private async handleReviewCode(args: CodeReviewRequest) {
      const { code, context, reviewers = ["both"] } = args;
    
      if (!code) {
        throw new Error("Code is required");
      }
    
      const reviews = await this.performReview(code, context, reviewers);
    
      return {
        content: [
          {
            type: "text",
            text: this.formatReviews(reviews),
          },
        ],
      };
    }
  • JSON Schema defining the input parameters for the "review_code" tool, including required 'code' field and optional 'context' and 'reviewers'.
    inputSchema: {
      type: "object",
      properties: {
        code: {
          type: "string",
          description: "The code to review",
        },
        context: {
          type: "string",
          description: "Additional context about the code (optional)",
        },
        reviewers: {
          type: "array",
          items: {
            type: "string",
            enum: ["codex", "gemini", "both"],
          },
          description: "Which reviewers to use (default: both)",
        },
      },
      required: ["code"],
    },
  • src/index.ts:187-213 (registration)
    Tool registration in the getTools() method, defining name, description, and inputSchema for the MCP tools list.
    {
      name: "review_code",
      description:
        "Request a code review from Codex and Gemini CLIs. Provide code directly as a string. Returns feedback from both reviewers for Claude to consider.",
      inputSchema: {
        type: "object",
        properties: {
          code: {
            type: "string",
            description: "The code to review",
          },
          context: {
            type: "string",
            description: "Additional context about the code (optional)",
          },
          reviewers: {
            type: "array",
            items: {
              type: "string",
              enum: ["codex", "gemini", "both"],
            },
            description: "Which reviewers to use (default: both)",
          },
        },
        required: ["code"],
      },
    },
  • src/index.ts:107-108 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes "review_code" calls to the specific handleReviewCode method.
    case "review_code":
      return await this.handleReviewCode(args as CodeReviewRequest);
  • Core helper method that performs the actual code review by calling available CLI tools (Codex/OpenAI and/or Gemini), validates responses, and collects feedback from selected reviewers.
    private async performReview(
      code: string,
      context: string | undefined,
      reviewers: string[]
    ): Promise<Record<string, string>> {
      const reviews: Record<string, string> = {};
      const useCodex = (reviewers.includes("codex") || reviewers.includes("both")) && this.cliAvailability.codex;
      const useGemini = (reviewers.includes("gemini") || reviewers.includes("both")) && this.cliAvailability.gemini;
    
      // If no CLIs are available, provide a helpful message
      if (!this.cliAvailability.codex && !this.cliAvailability.gemini) {
        reviews.info = "⚠️ No review CLIs are currently available. Please install OpenAI CLI and/or Gemini CLI to enable code reviews.\n\n" +
          "Check status with the check_cli_status tool.";
        return reviews;
      }
    
      const reviewPrompt = this.buildReviewPrompt(code, context);
    
      const reviewPromises: Promise<void>[] = [];
    
      if (useCodex) {
        reviewPromises.push(
          this.getCodexReview(reviewPrompt).then((review) => {
            reviews.codex = review;
          })
        );
      } else if (reviewers.includes("codex")) {
        reviews.codex = "⚠️ Codex review requested but OpenAI CLI is not available.";
      }
    
      if (useGemini) {
        reviewPromises.push(
          this.getGeminiReview(reviewPrompt).then((review) => {
            reviews.gemini = review;
          })
        );
      } else if (reviewers.includes("gemini")) {
        reviews.gemini = "⚠️ Gemini review requested but Gemini CLI is not available.";
      }
    
      await Promise.all(reviewPromises);
    
      return reviews;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool requests reviews from specific CLIs (Codex and Gemini) and returns feedback from both reviewers, but lacks details on permissions, rate limits, error handling, or what 'feedback' entails. It adds some behavioral context but leaves gaps for a mutation-like operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with key information in two concise sentences. Every sentence earns its place by stating the action, input method, and output purpose without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 3 parameters with full schema coverage, the description is moderately complete. It covers the basic operation and output intent but lacks details on behavioral traits like error cases or feedback format, which are important for a tool that interacts with external CLIs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters. The description adds minimal value beyond the schema by implying the 'code' parameter is provided as a string and 'reviewers' defaults to 'both', but does not elaborate on parameter interactions or usage nuances.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Request a code review') and resources ('from Codex and Gemini CLIs'), and distinguishes it from siblings by specifying it reviews code provided as a string (unlike review_directory or review_file which likely handle files/directories).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Provide code directly as a string'), but does not explicitly state when not to use it or name alternatives like review_directory or review_file. It implies usage for string-based code review without file system access.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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