review_code
Analyze code quality and security by submitting code for automated review using Codex and Gemini CLIs to receive structured feedback on best practices and improvements.
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
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The code to review | |
| context | No | Additional context about the code (optional) | |
| reviewers | No | Which reviewers to use (default: both) |
Implementation Reference
- src/index.ts:271-288 (handler)The primary handler function for the 'review_code' tool. It extracts arguments, validates required 'code' input, invokes the review logic via performReview, 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), }, ], }; }
- src/index.ts:187-213 (registration)The tool registration definition in the getTools() method, which is returned by ListToolsRequestHandler. Includes name, description, and detailed inputSchema.{ 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:17-23 (schema)TypeScript interface defining the structure of input arguments for review tools, including 'review_code'. Used for type safety in handler functions.interface CodeReviewRequest { filePath?: string; directory?: string; code?: string; reviewers?: string[]; context?: string; }
- src/index.ts:107-108 (handler)The switch case dispatcher in CallToolRequestSchema handler that routes 'review_code' calls to the specific handleReviewCode function.case "review_code": return await this.handleReviewCode(args as CodeReviewRequest);