Skip to main content
Glama

files.get_diff

Show the unified diff of a file between two commit hashes, revealing exactly what changed. Use with earlier and later hashes to compare versions.

Instructions

Return the unified diff of one file between two commit hashes (typically obtained from files.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 files.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)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.7.2

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so thoroughly: it declares read-only, no side effects, no auth, and no rate limits; it discloses error behavior ('Throws if either hash is unknown to the file's repo'); and it explains the semantic consequence of argument order (inverting the diff).

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 short, high-signal sentences are front-loaded with the core purpose and then deliver safety, ordering, error, and usage guidance in order. There is no filler or repetition of the schema.

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 3-parameter, read-only diff tool with no output schema, the description covers the operation, workflow context, safety profile, error behavior, and argument semantics. The return value ('unified diff') is self-descriptive to an agent, so nothing essential is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds meaningful usage context: it tells the agent that hashes 'typically [come] from files.get_history' and explains the practical effect of ordering them. It also relates the parameter to error behavior (unknown hashes throw), going beyond the schema's individual field descriptions.

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 precise verb-resource-object statement: 'Return the unified diff of one file between two commit hashes.' It clearly scopes to a single file and a diff between two commits, and it distinguishes itself from the sibling files.get_history by explicitly positioning this as the tool to see WHAT changed rather than just THAT it changed.

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 gives explicit when-to-use guidance: 'Use after files.get_history to see WHAT changed, not just THAT it changed,' naming the exact prior step and contrasting its purpose. It also provides parameter-usage guidance, stating that commit_a is treated as the earlier side and that reversing the arguments inverts the diff.

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