Skip to main content
Glama

Generate Diff

generate_diff
Read-onlyIdempotent

Generate and cache a diff of current branch working changes for code review. Call before other review tools to provide the diff.

Instructions

Generate a diff of the current branch working changes and cache it for all review tools. You MUST call this tool before calling any other review tool. Use "unstaged" for working-tree changes not yet staged, or "staged" for changes already added with git add.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo"unstaged": working-tree changes not yet staged. "staged": changes added to the index with git add. Default: unstaged.unstaged

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool completed successfully.
resultNoSuccessful result payload.
errorNoError payload when ok is false.
Behavior5/5

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

Beyond annotations (readOnlyHint, idempotentHint), the description discloses caching behavior and the prerequisite ordering, which are critical for correct use. No contradictions with 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?

Two sentences, no fluff. First sentence covers purpose and caching. Second sentence covers prerequisite and parameter usage. Front-loaded and efficient.

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

Completeness5/5

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

For a simple tool with one parameter, high schema coverage, and existing output schema, the description is complete. It covers purpose, usage constraints, caching side-effect, and parameter options.

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% and already explains the mode parameter in full. The description only reiterates the same information, adding no new meaning. 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?

Clearly states it generates a diff of current branch working changes and caches it for review tools. Verb is specific ('generate diff'), resource is clear ('current branch working changes'), and it distinguishes itself from siblings as a prerequisite.

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?

Explicitly says 'You MUST call this tool before calling any other review tool', providing clear when-to-use guidance. Also explains the two mode options with their contexts ('unstaged' vs 'staged'), giving no ambiguity.

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/j0hanz/code-lens'

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