Skip to main content
Glama

get_diff

Retrieve the unified diff between two commit hashes for a file, showing precisely what changed after reviewing its history.

Instructions

Return the unified diff of one file between two commit hashes (typically obtained from get_history for the same file). Read-only; no side effects, auth, or rate limits. Order matters — commit_a is treated as the earlier side; reversing the args inverts the diff. Throws if either hash is unknown to the file's repo. Use after get_history to see WHAT changed, not just THAT it changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesID of the file
commit_aYesEarlier commit hash (from get_history)
commit_bYesLater commit hash (from get_history)
Behavior5/5

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

With no annotations provided, the description carries full burden and excels: it states read-only, no side effects, auth, or rate limits; explains that order matters and reversing args inverts the diff; and discloses the error condition (throws if hash unknown). This is comprehensive behavioral disclosure.

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?

Three sentences, each packed with useful information: the core action, safety/behavioral traits, and usage guidance. No wasted words, and the most important information (what it does) comes first.

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?

Given no output schema and no annotations, the description covers all necessary context: the return type (unified diff), prerequisites (hashes from get_history), error behavior (throws on unknown hashes), and side-effect profile (read-only). It is complete for a function of this complexity.

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 has 100% coverage with basic descriptions, but the tool description adds crucial semantics: it emphasizes that commit_a is the earlier side and that reversing args inverts the diff. This goes beyond the schema by explaining the consequence of parameter order, which is essential for correct use.

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 verb ('Return'), the resource ('the unified diff of one file'), and the scope ('between two commit hashes'), distinguishing it from siblings like get_history (which shows that changed, not what) and diff_against_disk (which compares working tree). It is specific and unambiguous.

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?

The description explicitly says to use it after get_history and explains the benefit ('see WHAT changed, not just THAT it changed'). It also implies when not to use it (when you only need the history) and indicates the hashes typically come from get_history, providing clear context relative to alternatives.

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/safiyu/kontexta'

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