Skip to main content
Glama

review_directory

Get code review feedback for all files in a directory from Codex and Gemini CLIs to improve code quality, security, and best practices.

Instructions

Request a code review of all files in a directory from Codex and Gemini CLIs. Returns feedback from both reviewers for Claude to consider.

Input Schema

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

Implementation Reference

  • Primary handler for 'review_directory' tool: recursively finds code files in directory, reviews each with Codex/Gemini CLIs, collects and formats feedback.
    private async handleReviewDirectory(args: CodeReviewRequest) {
      const { directory, context, reviewers = ["both"] } = args;
    
      if (!directory) {
        throw new Error("Directory path is required");
      }
    
      const files = await this.getCodeFiles(directory);
      const allReviews: Array<{ file: string; reviews: Record<string, string> }> = [];
    
      for (const file of files) {
        const code = await fs.readFile(file, "utf-8");
        const reviews = await this.performReview(
          code,
          `File: ${file}\n${context || ""}`,
          reviewers
        );
        allReviews.push({ file, reviews });
      }
    
      return {
        content: [
          {
            type: "text",
            text: this.formatDirectoryReviews(allReviews),
          },
        ],
      };
    }
  • src/index.ts:241-267 (registration)
    Tool registration in getTools(): defines name, description, and inputSchema for 'review_directory'.
    {
      name: "review_directory",
      description:
        "Request a code review of all files in a directory from Codex and Gemini CLIs. Returns feedback from both reviewers for Claude to consider.",
      inputSchema: {
        type: "object",
        properties: {
          directory: {
            type: "string",
            description: "Path to the directory 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: ["directory"],
      },
    },
  • TypeScript interface for input args to review tools, including 'directory' for review_directory.
    interface CodeReviewRequest {
      filePath?: string;
      directory?: string;
      code?: string;
      reviewers?: string[];
      context?: string;
    }
  • Helper to recursively collect paths of code files (by extension) in a directory, used by handleReviewDirectory.
    private async getCodeFiles(directory: string): Promise<string[]> {
      const files: string[] = [];
      const entries = await fs.readdir(directory, { withFileTypes: true });
    
      for (const entry of entries) {
        const fullPath = path.join(directory, entry.name);
        if (entry.isDirectory()) {
          if (!entry.name.startsWith(".") && entry.name !== "node_modules") {
            files.push(...(await this.getCodeFiles(fullPath)));
          }
        } else if (this.isCodeFile(entry.name)) {
          files.push(fullPath);
        }
      }
    
      return files;
    }
  • Helper to format review results for multiple files in a directory.
    private formatDirectoryReviews(
      allReviews: Array<{ file: string; reviews: Record<string, string> }>
    ): string {
      let output = "# Directory Code Review Feedback\n\n";
      output += "Claude, please consider this feedback from other AI reviewers:\n\n";
    
      for (const { file, reviews } of allReviews) {
        output += `## File: ${file}\n\n`;
    
        if (reviews.codex) {
          output += "### Codex Review\n\n";
          output += reviews.codex;
          output += "\n\n";
        }
    
        if (reviews.gemini) {
          output += "### Gemini Review\n\n";
          output += reviews.gemini;
          output += "\n\n";
        }
    
        output += "---\n\n";
      }
    
      output += "Please analyze this feedback and provide your own assessment of the codebase.";
    
      return output;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden. It discloses that the tool requests reviews from external CLIs and returns feedback, but doesn't mention authentication needs, rate limits, error conditions, or what happens if the directory doesn't exist. For a tool interacting with external services, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is appropriately concise with two sentences that efficiently convey purpose and outcome. It's front-loaded with the core functionality. The second sentence about Claude integration could be slightly more integrated, but overall it's well-structured with minimal waste.

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 3 parameters with full schema coverage but no annotations or output schema, the description provides adequate purpose but lacks behavioral context for a tool that interacts with external CLIs. It doesn't explain the format or structure of the returned feedback, which is important since there's no output schema.

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 thoroughly. The description adds no additional parameter semantics beyond what's in the schema. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

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 specific action ('Request a code review'), target resource ('all files in a directory'), and tools involved ('Codex and Gemini CLIs'). It distinguishes from sibling tools like 'review_file' (single file) and 'review_code' (unclear scope) by specifying directory-level review.

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

Usage Guidelines3/5

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

The description implies usage for directory-level code reviews but doesn't explicitly state when to use this tool versus alternatives like 'review_file' or 'review_code'. It mentions 'for Claude to consider' which suggests integration context, but lacks clear when/when-not guidance or prerequisite conditions.

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