Skip to main content
Glama

diff

Compare two markdown documents or fetched URLs and return a unified diff, structured hunks, or line count summary.

Instructions

Compute a diff between two markdown bodies or two URL fetches.

Key parameters:

  • old: { url?, markdown?, content_hash? } — left-hand side. URL form reads from cache; cache miss returns a structured cache_miss error (no network re-fetch).

  • new: { url?, markdown? } — right-hand side. Same cache rules as old.

  • output: 'unified' (default, git-style patch) | 'hunks' (structured array) | 'summary' (line counts only).

  • granularity: 'line' (default) | 'word' | 'section'. Section walks H1/H2/H3 boundaries and tags each hunk with section_title.

Returns { changed, summary, unified_diff?|hunks?, truncated? }. summary always present (added/removed/modified lines + total_changed_chars). Above the 5000-line cap the engine emits truncated: true plus an approximate summary — never silently degrades.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
newNoRight-hand side of the diff. Requires one of { url, markdown }.
oldNoLeft-hand side of the diff. Requires one of { url, markdown, content_hash }.
outputNoDiff output shape. unified=git-style patch, hunks=structured per-section, summary=counts only (added_lines / removed_lines / modified_lines / total_changed_chars where total_changed_chars = sum of added_line_chars + removed_line_chars across the LCS edit script). Default: unified.
granularityNoDiff granularity. line=per-line LCS (default). word=token-level LCS — hunks contain only the changed tokens, tighter than line for intra-line edits. section walks H1/H2/H3 boundaries.
Behavior5/5

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

The description comprehensively discloses behavioral traits: cache rules for URL fetches, structured cache_miss error, truncation at 5000 lines with explicit truncated field, and granularity options. Since no annotations are provided, the description carries the full burden and meets it excellently.

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 well-structured, starting with purpose then listing key parameters and return value. It is informative but slightly lengthy; every sentence earns its place, though minor trimming could improve conciseness.

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 complexity (4 parameters, 2 enums, nested objects, no output schema), the description covers all essential aspects: input format, caching, output shape, granularity, edge cases (truncation, error). It is complete enough for an agent to invoke correctly.

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 parameters are documented in schema. The description adds value by explaining semantics beyond schema, such as default values, cache miss handling, and detailed output shapes. However, it doesn't elaborate on nested object properties beyond the schema, which is acceptable given high coverage.

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 tool computes a diff between two markdown bodies or URL fetches. It specifies the verb 'compute a diff' and the resources (markdown bodies, URL fetches), distinguishing it from siblings like fetch or crawl.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides guidance on when to use the tool but does not explicitly contrast with alternatives. It details key parameters and their roles, and mentions cache behavior which informs usage. However, it could explicitly state when to use diff over other tools like fetch or research.

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/KnockOutEZ/wigolo'

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