Skip to main content
Glama

diff_documents

Compare two documents in any supported format and return their differences, including cross-format comparisons, as unified text or JSON.

Instructions

Compare two documents and return their differences.

Each input is auto-detected (file path, data URI, base64, or inline content), so documents in any supported format can be compared — even across formats (e.g. a DOCX against its PDF export).

Returns a dictionary with:

  • diff: the rendered diff (unified text or JSON string)

  • has_changes: whether any differences were found

Input Schema

NameRequiredDescriptionDefault
newYesUpdated document: file path (within read allowlist), data URI, base64, or inline content. REQUIRED.
oldYesOriginal document: file path (within read allowlist), data URI, base64, or inline content. REQUIRED.
formatNoOutput format: 'unified' (default, plain text) or 'json' (structured).unified
granularityNoComparison granularity: 'block' (default), 'sentence', or 'word'.block
context_linesNoContext lines around changes in unified output (default: 3).
ignore_whitespaceNoNormalize whitespace before comparing. Default: false.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.19.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the disclosure burden. It does add real context — inputs are auto-detected from path, data URI, base64, or inline content, and the comparison works across formats — but it says nothing about error behavior for unsupported formats, read-allowlist failures, size limits, or cost of large comparisons.

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?

Front-loaded with the core action in one sentence, then a compact bullet list for the return value. The 'Returns a dictionary with' block partly duplicates the existing output schema, which costs some space, but nothing is padded or verbose.

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?

Given a six-parameter tool with an output schema, the description covers input flexibility, cross-format support, and the shape of the result. Remaining gaps (failure modes for unsupported or oversized documents) are modest for a read-only comparison operation.

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%, so every parameter is already documented in the schema; baseline 3 applies. The description adds only the input auto-detection idea and does not elaborate on format, granularity, context_lines, or ignore_whitespace beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Compare two documents and return their differences') plus a notable capability: cross-format comparison such as DOCX vs its PDF export. It is clearly distinct from the siblings (read_document_as_markdown, search_documents, get_document_outline, list_workspace_files), though it never explicitly names an alternative.

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

Usage Guidelines3/5

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

Usage is only implied by the purpose — an agent infers that this is the tool for 'are these two documents different' questions. There is no explicit when-to-use/when-not guidance, no statement about prerequisites, and no routing advice versus the read/search/outline siblings.

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