Skip to main content
Glama

gemini_analyze

Analyze a codebase or file with Gemini to map architecture, dependencies, and patterns, or audit for bugs and security issues across many files.

Instructions

Perform deep, structured analysis of a codebase or file using Gemini. USE THIS TOOL WHEN: (1) You need to understand the architecture of a large, unfamiliar project. (2) You want to audit code for bugs or security vulnerabilities across many files. (3) You need to map out dependencies or identify design patterns in a codebase. (4) You have a specific analytical question about a codebase that requires reading many files. This tool is MORE STRUCTURED than gemini_summarize — it uses specialized prompts for each analysis type and produces categorized, actionable findings. Automatically filters out node_modules, .git, binary files, and other non-essential content.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "target_path": "<target_path>",
      "analysis_type": "<analysis_type>"
    },
    "name": "gemini_analyze"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoOverride the default Gemini model. If omitted, uses the server default.
max_depthNoMaximum directory traversal depth (default: 5). Only applies to directories.
target_pathYesAbsolute path to the file or directory to analyze.
analysis_typeYesType of analysis to perform: "architecture" — module boundaries, data flow, entry points. "dependencies" — external/internal deps, circular deps, risks. "patterns" — design patterns, conventions, coding style. "bugs" — potential bugs, race conditions, resource leaks. "security" — injection, auth, secrets, OWASP Top 10.
specific_questionNoAn additional specific question to answer about the code. This is appended to the analysis prompt for focused results. Example: "Is the database connection pool properly managed?"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden. It discloses that the tool uses specialized prompts per analysis type, produces 'categorized, actionable findings,' and automatically filters out node_modules, .git, binary files, and other non-essential content. It does not explicitly state that the operation is read-only or that code is sent to an external Gemini service, which is a meaningful gap for an analysis tool, but the filtering and prompt-specialization details are strong.

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 front-loaded with the core purpose and then a clearly enumerated usage list. The sentence about filtering is useful and earns its place. It is somewhat longer than strictly necessary, but the structure is clear and there is no significant waste.

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

Completeness4/5

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

For a moderately complex tool with five parameters, an enum, no annotations, and no output schema, the description covers purpose, usage scenarios, sibling comparison, prompt specialization, and content filtering. It could say more about the return structure or privacy/read-only implications, but it is largely complete for an agent to call it correctly.

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 five parameters in detail. The description adds only marginal context by implying that analysis_type drives specialized prompts and that specific_question appends to the prompt, but the schema already covers those semantics. Baseline 3 is appropriate.

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

Purpose5/5

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

The description opens with a specific verb and resource ('Perform deep, structured analysis of a codebase or file using Gemini') and explicitly distinguishes itself from the sibling gemini_summarize by being 'MORE STRUCTURED' and using specialized prompts. An agent can tell exactly what this tool does and how it differs from the closest alternative.

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

Usage Guidelines5/5

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

It provides an explicit 'USE THIS TOOL WHEN' list with four concrete scenarios (architecture understanding, bug/security audit, dependency mapping, specific multi-file questions) and names the alternative gemini_summarize with the condition that selects it. Nothing is left to inference.

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