Skip to main content
Glama

review_directory

Analyze all files in a directory using Codex and Gemini code review tools to identify quality, security, and performance issues while providing actionable feedback for improvement.

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
contextNoAdditional context about the code (optional)
directoryYesPath to the directory to review
reviewersNoWhich reviewers to use (default: both)

Implementation Reference

  • Main handler function for the 'review_directory' tool. Reads all code files recursively from the directory, performs reviews using available CLIs (Codex/Gemini), and formats the results.
    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), }, ], }; }
  • TypeScript interface defining the input parameters for code review tools, including 'directory' for review_directory.
    interface CodeReviewRequest { filePath?: string; directory?: string; code?: string; reviewers?: string[]; context?: string; }
  • src/index.ts:241-267 (registration)
    Tool registration in getTools(): defines name, description, and JSON 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"], }, },
  • Dispatch handler in CallToolRequestSchema that routes 'review_directory' calls to the main handler.
    case "review_directory": return await this.handleReviewDirectory(args as CodeReviewRequest);
  • Helper function to recursively traverse directory and collect paths of code files (excluding dotfiles and node_modules).
    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; }

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