Skip to main content
Glama
emmron
by emmron

mcp__gemini__code_analyze

Analyze code for quality and issues by specifying the programming language and analysis type. Improve code structure and identify potential problems with this AI-driven tool.

Instructions

Analyze code for quality and issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysis_typeNoType of analysiscomprehensive
codeYesCode to analyze
languageNoProgramming language

Implementation Reference

  • The handler function that implements the core logic of the 'mcp__gemini__code_analyze' tool. It destructures arguments, validates input, constructs an analysis prompt, calls the AI client for code review, and formats the response.
          async (args) => {
            const { code, language = 'javascript', analysis_type = 'comprehensive' } = args;
            validateString(code, 'code', 10000);
            
            const prompt = `Analyze this ${language} code for ${analysis_type} review:
    
    \`\`\`${language}
    ${code}
    \`\`\`
    
    Provide:
    1. Code quality assessment
    2. Security vulnerabilities
    3. Performance issues
    4. Best practice violations
    5. Specific improvement suggestions`;
    
            const analysis = await aiClient.call(prompt, 'analysis');
            return `📊 **Code Analysis** (${analysis_type})\\n\\n${analysis}`;
          }
  • The registration of the 'mcp__gemini__code_analyze' tool in the ToolRegistry class, specifying name, description, input parameters, and the handler function.
        this.registerTool(
          'mcp__gemini__code_analyze',
          'Analyze code for quality and issues',
          {
            code: { type: 'string', description: 'Code to analyze', required: true },
            language: { type: 'string', description: 'Programming language' },
            analysis_type: { type: 'string', description: 'Type of analysis', default: 'comprehensive' }
          },
          async (args) => {
            const { code, language = 'javascript', analysis_type = 'comprehensive' } = args;
            validateString(code, 'code', 10000);
            
            const prompt = `Analyze this ${language} code for ${analysis_type} review:
    
    \`\`\`${language}
    ${code}
    \`\`\`
    
    Provide:
    1. Code quality assessment
    2. Security vulnerabilities
    3. Performance issues
    4. Best practice violations
    5. Specific improvement suggestions`;
    
            const analysis = await aiClient.call(prompt, 'analysis');
            return `📊 **Code Analysis** (${analysis_type})\\n\\n${analysis}`;
          }
        );
  • The input parameters object used to generate the JSON schema for the tool's arguments: code (required string), language (string), analysis_type (string with default).
    {
      code: { type: 'string', description: 'Code to analyze', required: true },
      language: { type: 'string', description: 'Programming language' },
      analysis_type: { type: 'string', description: 'Type of analysis', default: 'comprehensive' }

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

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