Skip to main content
Glama

Diff files

diff_files
Read-only

Compare two workspace files to produce a unified diff with added and removed line counts, useful for checking a backup against the current version.

Instructions

Unified diff between two workspace files. Use when: you compare two versions of a file, such as a backup and the current one. Avoid when: binary files, or git history (run git with shell_run). Output: lines_added, lines_removed, unified_diff, truncated.

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": {
      "relative_path_a": "<relative_path_a>",
      "relative_path_b": "<relative_path_b>"
    },
    "name": "diff_files"
  }
}

Input Schema

NameRequiredDescriptionDefault
max_linesNoMax diff lines returned (default 500, max 10000).
context_linesNoUnchanged context lines around each hunk (default 3, max 50).
relative_path_aYesWorkspace-relative ('.' = root); absolute/.. outside it rejected.
relative_path_bYesWorkspace-relative ('.' = root); absolute/.. outside it rejected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the description's added value is in disclosing return fields (lines_added, lines_removed, unified_diff, truncated) and the existence of truncation, which matters because there is no output schema. It stops short of saying what happens on a missing/unreadable file or how truncation affects the summary counts.

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 labeled lines (purpose, use, avoid, output) with the core statement front-loaded and no redundant restatement of the tool name. Every sentence contributes either routing or return-value information.

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 read-only two-path tool with a fully documented schema, the definition covers purpose, routing, exclusions, and return fields without an output schema. It is slightly thin on failure modes (missing file, encoding, truncation semantics) and on how the two required paths relate to the workspace root, which the schema handles.

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%, including defaults and bounds for max_lines and context_lines, so the schema carries the parameter burden. The description adds no format or semantics detail beyond what is already documented, which is the baseline case for a fully described schema.

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?

"Unified diff between two workspace files" names a specific operation and resource, and the workspace-file scope distinguishes it from repository-history tooling. An agent can tell immediately what it gets back and what input domain it applies to.

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 when" (comparing two versions, e.g. backup vs. current) and an explicit "Avoid when" (binary files, git history), and it points to a concrete alternative (shell_run) for the excluded case. That is the full when/when-not/alternative triad.

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