Skip to main content
Glama

Diff two texts

diff_text
Read-onlyIdempotent

Compare text a with text b by lines (default), words or chars. Returns ops (equal/insert/delete), a unified diff (lines mode), optional escaped HTML redline, stats and similarity. Deterministic diff (Myers algorithm via jsdiff), not an AI or semantic comparison. Limits per side: lines mode 64 KB and 1,000 lines, words mode 8 KB, chars mode 4 KB. If the texts need more than 250 inserted plus deleted units, the API returns 422 too_different instead of a partial diff. Patches up to 64 KB apply to text up to 64 KB. No 3-way merge, no binary files. Stateless: text is not stored or logged; no URL fetching.

Input Schema

NameRequiredDescriptionDefault
aYesOriginal text.
bYesChanged text.
modeNo
contextNo
formatsNo
label_aNo
label_bNo
ignore_caseNo
ignore_whitespaceNolines mode only

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive behavior, and the description adds substantial context beyond that. It discloses the algorithm, size limits per mode, the 250-unit 422 cutoff, patch applicability limits, and statelessness/no logging/no URL fetching.

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?

The description is dense but front-loaded: purpose and modes come first, followed by output characteristics, determinism, limits, failure behavior, and statefulness. Every sentence adds useful information without repetition.

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?

With no output schema and nine parameters, the description does a strong job covering return formats, limits, errors, and statelessness. The remaining gap is that a few optional parameters and their behavior are left to the schema alone.

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 description coverage is low at 33%, so the description must carry the burden; it explains mode values and defaults, output formats, and that ignore_whitespace is lines-mode only. However, several optional parameters such as context, label_a, label_b, and ignore_case are not described, leaving some gaps.

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 gives a specific verb and resource ('Compare text a with text b') and immediately enumerates modes (lines, words, chars). It also distinguishes the tool from semantic comparison siblings by stating it is a deterministic Myers diff, not an AI or semantic comparison.

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?

It clearly states the default mode, the available modes, and important limits and failure behavior (422 too_different). It also rules out 3-way merge and binary files, but it does not explicitly route the agent between this tool and the sibling apply_patch or text_similarity.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources