Skip to main content
Glama

Analyze a file

diffgate_analyze
Read-onlyIdempotent

Analyze code files for review findings, flagging only changes vs git baseline. Supports unsaved or generated code via content input.

Instructions

Analyze a file for code review findings. Only flags risk on lines changed vs the git baseline (diff-aware). Pass content to analyze unsaved or generated code before it is written to disk. When a code graph is available, public-surface findings carry an impact field (caller count, suggested reviewers, test gaps) and may be tier-adjusted — fix high-blast-radius findings before surfacing the code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepo root directory. Defaults to process.cwd().
contentNoFile content to analyze. Omit to read from disk.
filePathYesAbsolute or repo-relative path to the file.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
tierYesOverall risk tier for the file.
findingsYesPer-line findings, each with ruleId, tier, line, and message.
_diffgateNoCapability hint: which layers (core/graph/llm) produced this result.
Behavior4/5

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

Annotations already mark the tool as read-only and idempotent, so the description adds value by disclosing diff-aware behavior and impact field adjustments. No contradictions; it contributes context beyond annotations.

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

Conciseness5/5

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

Four sentences with no fluff; the purpose is front-loaded in the first sentence. Every sentence adds distinct information, making it efficient and easy to parse.

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?

Given the output schema exists, the description adequately covers diff-aware analysis, content parameter usage, and code graph impact. It lacks details on error handling or rate limits, but for a non-destructive, idempotent tool, it is fairly complete.

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

Parameters4/5

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

The schema covers all three parameters fully (100%), but the description adds specific use-case guidance for the `content` parameter (unsaved code), enhancing understanding. No additional detail for `filePath` or `cwd`, so it's above baseline.

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 clearly states the tool analyzes a file for code review findings and is diff-aware, which distinguishes it from siblings like diffgate_check_staged and diffgate_deep_review by highlighting its focus on changes from git baseline.

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

Usage Guidelines3/5

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

While it explains when to use the `content` parameter (unsaved/generated code) and mentions code graph availability, it does not explicitly guide when to use this tool over its siblings or when not to use it, leaving the agent to infer usage context.

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

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/srbsa/diffgate'

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