codeReview
Analyze code to identify bugs, security vulnerabilities, and deviations from established best practices.
Instructions
Review code for bugs, security issues, and best practices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The code to review |
Implementation Reference
- src/server/tools.ts:183-202 (handler)The handler function that executes the 'codeReview' tool logic. It currently returns a placeholder response indicating that actual code review is handled via LLM prompts.async ({ code }) => { try { // In a real implementation, this would call an LLM to review the code // For now, we'll just return a placeholder message return { content: [{ type: "text", text: "Code review functionality will be handled by the LLM through prompts." }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true }; } }
- src/server/tools.ts:177-203 (registration)The registration of the 'codeReview' tool using server.tool(), including name, description, schema, and handler.server.tool( "codeReview", "Review code for bugs, security issues, and best practices", { code: z.string().describe("The code to review") }, async ({ code }) => { try { // In a real implementation, this would call an LLM to review the code // For now, we'll just return a placeholder message return { content: [{ type: "text", text: "Code review functionality will be handled by the LLM through prompts." }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true }; } } );
- src/server/tools.ts:180-182 (schema)Input schema for the 'codeReview' tool, defining the 'code' parameter.{ code: z.string().describe("The code to review") },
- src/server/prompts.ts:93-124 (helper)Supporting prompt template for code review, which provides the LLM instructions for reviewing code, as referenced by the tool handler.server.prompt( "codeReview", "Prompt for reviewing code", { code: z.string().describe("The code to review") }, ({ code }) => ({ messages: [ { role: "user", content: { type: "text", text: `SYSTEM: You are a code review assistant. Please review the provided code for: 1. Bugs and logical errors 2. Security vulnerabilities 3. Performance issues 4. Code style and best practices 5. Potential improvements Be specific and provide actionable feedback.` } }, { role: "user", content: { type: "text", text: `Please review this code:\n\n${code}` } } ] }) );