Skip to main content
Glama

Find differences between two texts by line, word or character

text_diff
Read-only

Differences between two texts: mode lines, words or chars; the added, removed and unchanged parts with counts, a similarity ratio (2 x unchanged / both texts' units), and a unified diff for lines. Body { a, b, mode }: lines and words up to 50 KB each, chars up to 20 KB each (capped for the Worker's CPU budget). Pure code using the diff package (BSD-3-Clause). Related tools on this server, for a different need: text_chunk when you need to generate overlapping text chunks with character offsets; text_answer when you need answers a question from the given text only. Price: $0.002 per successful call, paid with x402 (USDC on Base, Solana and 10 more networks); failed calls are not charged.

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": {
      "a": "<a>",
      "b": "<b>"
    },
    "name": "text_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
aYesThe first text (JSON body field)
bYesThe second text (JSON body field)
modeNolines (default), words or chars

Output Schema

NameRequiredDescriptionDefault
modeNo
partsNo
countsNo
sourceNo
checkedAtNo
identicalNo
similarityNo
unifiedDiffNo
partsTruncatedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the read-only annotation, the description discloses output components, the similarity-ratio formula, line-mode unified diff behavior, mode-specific input caps tied to CPU limits, implementation dependency, licensing, and pricing. It also states that failed calls are not charged, which is important operational context for a paid x402 tool.

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 definition is front-loaded with purpose, modes, outputs, and limits, then follows with implementation and pricing details. It is information-dense and mostly earns its space, though the diff-package/license note is less directly useful for invocation and the first sentence is quite packed.

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 output schema exists, the description does not need to explain return values, yet it helpfully summarizes output parts and the similarity formula. Combined with size caps, pricing, and sibling routing, it provides complete context for correct selection and invocation.

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?

The schema already covers all three parameters at 100%, but the description adds valuable mode-specific size limits: lines and words up to 50 KB, chars up to 20 KB. It also clarifies the body shape and default mode usage, giving meaningful constraints beyond the schema descriptions.

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 states a specific verb and resource: finding differences between two texts, with line, word, or character modes. It distinguishes the tool from related siblings by naming text_chunk and text_answer only for different needs. An agent can immediately tell that this tool is the text-differencing operation.

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 gives clear context for when the tool applies and explicitly routes text-chunking and question-answering needs to sibling tools. It does not provide a general when-not-to-use statement for diffing itself, but the mode-specific size limits implicitly define operational boundaries.

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