Skip to main content
Glama
comprehensive-review.ts3.04 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { executeComprehensiveAnalysis } from '../utils/code2prompt-executor.js'; import { executeComprehensiveReview } from '../utils/gemini-executor.js'; export const comprehensiveReviewTool: Tool = { name: 'gemini_comprehensive_review', description: 'Perform a comprehensive codebase review using Gemini CLI with full codebase context via code2prompt', inputSchema: { type: 'object', properties: { workingDir: { type: 'string', description: 'The working directory path of the codebase to analyze', }, excludePatterns: { type: 'array', items: { type: 'string', }, description: 'Optional patterns to exclude from the analysis (e.g., "tests/**", "*.md")', default: [], }, }, required: ['workingDir'], }, }; export async function handleComprehensiveReview(args: any) { try { const { workingDir, excludePatterns = [] } = args; console.log(`Starting comprehensive codebase review for: ${workingDir}`); // Step 1: Execute code2prompt to get full codebase content console.log('Analyzing codebase with code2prompt...'); const code2promptResult = await executeComprehensiveAnalysis(workingDir); if (code2promptResult.error) { throw new Error(`code2prompt execution failed: ${code2promptResult.error}`); } if (!code2promptResult.output) { throw new Error('No codebase content extracted by code2prompt'); } console.log(`Codebase analysis complete. Token count: ${code2promptResult.tokenCount || 'unknown'}`); // Step 2: Send to Gemini CLI for comprehensive review console.log('Sending to Gemini CLI for architectural review...'); const geminiResult = await executeComprehensiveReview( code2promptResult.output, workingDir ); if (geminiResult.error) { throw new Error(`Gemini CLI execution failed: ${geminiResult.error}`); } if (!geminiResult.response) { throw new Error('No response received from Gemini CLI'); } console.log('Comprehensive review completed successfully'); return { content: [ { type: 'text', text: JSON.stringify({ success: true, analysis: { tokenCount: code2promptResult.tokenCount, reviewResponse: geminiResult.response, workingDirectory: workingDir, timestamp: new Date().toISOString(), } }, null, 2) } ] }; } catch (error) { console.error('Error in comprehensive review:', error); return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', timestamp: new Date().toISOString(), }, null, 2) } ], isError: true }; } }

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/Artegy/gemini-cli-mcp'

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