Skip to main content
Glama

AI Development Assistant MCP Server

by yeakub108
codeReview.ts1.28 kB
import { z } from "zod"; import { execSync } from "child_process"; /** * CodeReview tool * - Takes in a file path and runs "git diff main -- <filePath>" * - Returns the diff along with instructions to review and fix issues */ export const codeReviewToolName = "code-review"; export const codeReviewToolDescription = "Run a git diff against main on a specified file and provide instructions to review/fix issues."; export const CodeReviewToolSchema = z.object({ folderPath: z.string().min(1, "A folder path is required."), }); export async function runCodeReviewTool( args: z.infer<typeof CodeReviewToolSchema>, ) { const { folderPath } = args; let diffOutput = ""; try { diffOutput = execSync(`git -C "${folderPath}" diff`, { encoding: "utf-8", }); } catch (error) { // If there's an error (e.g., no git repo, or the file doesn't exist), include it in the response. diffOutput = `Error running git diff: ${error}`; } const instructions = "Review this diff for any obvious issues. Fix them if found, then finalize the changes."; const message = `Git Diff Output:\n${diffOutput}\n\nInstructions:\n${instructions}`; return { content: [ { type: "text", text: message, }, ], }; }

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/yeakub108/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server