review_file
Analyze code files with Codex and Gemini reviewers to get feedback on quality, security, and best practices for Claude's consideration.
Instructions
Request a code review of a specific file from Codex and Gemini CLIs. Returns feedback from both reviewers for Claude to consider.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the file to review | |
| context | No | Additional context about the code (optional) | |
| reviewers | No | Which reviewers to use (default: both) |
Implementation Reference
- src/index.ts:290-312 (handler)The primary handler function for the 'review_file' tool. Reads the file content using fs.readFile, invokes performReview with context, and returns formatted review feedback.private async handleReviewFile(args: CodeReviewRequest) { const { filePath, context, reviewers = ["both"] } = args; if (!filePath) { throw new Error("File path is required"); } const code = await fs.readFile(filePath, "utf-8"); const reviews = await this.performReview( code, `File: ${filePath}\n${context || ""}`, reviewers ); return { content: [ { type: "text", text: this.formatReviews(reviews), }, ], }; }
- src/index.ts:17-23 (schema)TypeScript interface defining the input parameters for review tools, including filePath required for review_file.interface CodeReviewRequest { filePath?: string; directory?: string; code?: string; reviewers?: string[]; context?: string; }
- src/index.ts:218-239 (schema)JSON schema in the tool definition specifying input validation for review_file: requires filePath, optional context and reviewers.inputSchema: { type: "object", properties: { filePath: { type: "string", description: "Path to the file 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: ["filePath"], },
- src/index.ts:214-240 (registration)Registration of the 'review_file' tool in the getTools() method, which is returned by the ListTools handler.{ name: "review_file", description: "Request a code review of a specific file from Codex and Gemini CLIs. Returns feedback from both reviewers for Claude to consider.", inputSchema: { type: "object", properties: { filePath: { type: "string", description: "Path to the file 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: ["filePath"], }, },
- src/index.ts:109-110 (handler)Dispatcher case in the CallToolRequestSchema handler that routes 'review_file' calls to the specific handleReviewFile method.case "review_file": return await this.handleReviewFile(args as CodeReviewRequest);