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' }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions analyzing for 'quality and issues', but doesn't specify what types of issues (e.g., bugs, security, performance), the depth of analysis, output format, or any constraints like rate limits or authentication needs. This leaves significant gaps for a tool with no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a basic tool definition, though it could be more front-loaded with critical details given the lack of annotations and sibling tool complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by sibling tools and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the analysis returns, how results are structured, or any behavioral traits, making it inadequate for an agent to understand the tool's full context and use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters ('analysis_type', 'code', 'language') with descriptions. The description adds no additional meaning beyond what's in the schema, such as examples of analysis types or language support. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Analyze code for quality and issues' states a clear verb ('analyze') and resource ('code'), but it's vague about what 'quality and issues' specifically entails. It doesn't distinguish this tool from sibling tools like 'mcp__gemini__analyze_codebase', 'mcp__gemini__codereview_expert', or 'mcp__gemini__quality_guardian', which likely have overlapping purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With multiple sibling tools that appear related to code analysis (e.g., 'analyze_codebase', 'codereview_expert', 'quality_guardian'), the description lacks any context about specific use cases, prerequisites, or comparisons to help an agent choose appropriately.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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