Skip to main content
Glama

diff

Compare two files side by side and get a unified diff with semantic similarity score. Reuses cached content to reduce token consumption.

Instructions

Compare two files side by side and return a unified diff.

Use this for explicit file-to-file comparison. For "what changed since I last read this file?", use read instead of diff.

Behavior:

  • Returns unified diff plus semantic similarity score.

  • Reuses cached content when possible.

  • Large diffs may be suppressed to stay within token budget.

Args: path1: First file path. path2: Second file path. context_lines: Number of context lines to include around changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
path1Yes
path2Yes
context_linesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
truncatedNo
path1No
path2No
diffNo
diff_stateNo
diff_omittedNo
similarityNo
diff_statsNo
tokens_savedNo
from_cacheNo
context_linesNo
Behavior4/5

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

Since annotations are absent, the description carries full burden. It discloses that the tool returns a unified diff plus semantic similarity score, reuses cached content, and may suppress large diffs for token budgets. This covers key behaviors, though it omits potential error conditions or permission requirements.

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

Conciseness4/5

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

The description is front-loaded with the primary purpose, followed by usage guidance, a behavior list, and parameter definitions. Every sentence is substantive, but the structure could be slightly more streamlined by integrating the behaviors into the main description.

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 the tool's simplicity and the presence of an output schema (not shown but declared), the description is complete: it covers purpose, usage, behaviors, and parameter semantics. No additional information seems necessary for correct invocation.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate. It includes an 'Args' section that defines each parameter: 'path1: First file path', 'path2: Second file path', 'context_lines: Number of context lines to include around changes.' This adds meaning beyond the schema's types and defaults.

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 'Compare two files side by side and return a unified diff,' which is a specific verb+resource. It also distinguishes from siblings by noting that for 'what changed since I last read', one should use 'read' instead.

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 'Use this for explicit file-to-file comparison. For "what changed since I last read this file?", use `read` instead of `diff`.' This provides clear when-to-use and when-not-to-use guidance, with an alternative tool named.

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/CoderDayton/semantic-cache-mcp'

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