Skip to main content
Glama

gemini_analyze_codebase

Analyze entire codebases to identify patterns, duplications, architectural issues, and suggest improvements for architecture, security, performance, or general code quality.

Instructions

Specialized tool for analyzing entire codebases. Gemini will find patterns, duplications, architectural issues, and suggest improvements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codebaseYesThe entire codebase or multiple files concatenated
focusNoWhat to focus on: 'architecture', 'duplications', 'security', 'performance', or 'general'

Implementation Reference

  • The execution handler for the 'gemini_analyze_codebase' tool. It extracts parameters, constructs a specialized prompt based on focus area, calls Gemini 2.5 Flash model to analyze the codebase, and returns the analysis as text content.
    if (name === "gemini_analyze_codebase") { const { codebase, focus = "general" } = args; const focusPrompts = { architecture: "Analyze the overall architecture, design patterns, and structural issues. Suggest improvements.", duplications: "Find duplicated code, similar patterns, and opportunities for refactoring. Be specific.", security: "Identify security vulnerabilities, unsafe practices, and potential exploits.", performance: "Find performance bottlenecks, inefficient algorithms, and optimization opportunities.", general: "Provide a comprehensive analysis covering architecture, code quality, potential issues, and improvements.", }; const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" }); const prompt = `You are an expert code reviewer. Analyze this codebase with focus on: ${focus} ${focusPrompts[focus]} Codebase: \`\`\` ${codebase} \`\`\` Provide: 1. Key findings 2. Specific issues with file/line references 3. Actionable recommendations 4. Priority ranking (High/Medium/Low)`; const result = await model.generateContent(prompt); const response = await result.response; return { content: [ { type: "text", text: `[Gemini Codebase Analysis - ${focus}]\n\n${response.text()}`, }, ], }; }
  • The input schema definition for the 'gemini_analyze_codebase' tool, specifying parameters like codebase (required string) and optional focus enum.
    inputSchema: { type: "object", properties: { codebase: { type: "string", description: "The entire codebase or multiple files concatenated", }, focus: { type: "string", description: "What to focus on: 'architecture', 'duplications', 'security', 'performance', or 'general'", enum: [ "architecture", "duplications", "security", "performance", "general", ], }, }, required: ["codebase"], },
  • index.js:68-94 (registration)
    The tool registration in the ListTools response, including name, description, and input schema for 'gemini_analyze_codebase'.
    { name: "gemini_analyze_codebase", description: "Specialized tool for analyzing entire codebases. Gemini will find patterns, duplications, architectural issues, and suggest improvements.", inputSchema: { type: "object", properties: { codebase: { type: "string", description: "The entire codebase or multiple files concatenated", }, focus: { type: "string", description: "What to focus on: 'architecture', 'duplications', 'security', 'performance', or 'general'", enum: [ "architecture", "duplications", "security", "performance", "general", ], }, }, required: ["codebase"], }, },

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/Yoon-jongho/claude-to-gemini'

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