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; }

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