Skip to main content
Glama
paladini

devutils-mcp-server

text_diff

Compare two text strings to identify line-by-line differences, showing additions with '+' and deletions with '-'.

Instructions

Compare two strings and show a simple line-by-line diff. Lines prefixed with '+' are additions, '-' are deletions, ' ' are unchanged.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
text1YesFirst text (original)
text2YesSecond text (modified)

Implementation Reference

  • The implementation of the text_diff tool, including its schema definition and the logic to compare two texts and produce a line-by-line diff.
    server.tool(
      "text_diff",
      "Compare two strings and show a simple line-by-line diff. Lines prefixed with '+' are additions, '-' are deletions, ' ' are unchanged.",
      {
        text1: z.string().describe("First text (original)"),
        text2: z.string().describe("Second text (modified)"),
      },
      async ({ text1, text2 }) => {
        const lines1 = text1.split("\n");
        const lines2 = text2.split("\n");
        const maxLen = Math.max(lines1.length, lines2.length);
        const diffLines: string[] = [];
    
        for (let i = 0; i < maxLen; i++) {
          const l1 = i < lines1.length ? lines1[i] : undefined;
          const l2 = i < lines2.length ? lines2[i] : undefined;
    
          if (l1 === l2) {
            diffLines.push(`  ${l1}`);
          } else {
            if (l1 !== undefined) diffLines.push(`- ${l1}`);
            if (l2 !== undefined) diffLines.push(`+ ${l2}`);
          }
        }
    
        const summary = {
          lines_in_original: lines1.length,
          lines_in_modified: lines2.length,
          additions: diffLines.filter((l) => l.startsWith("+ ")).length,
          deletions: diffLines.filter((l) => l.startsWith("- ")).length,
          unchanged: diffLines.filter((l) => l.startsWith("  ")).length,
        };
    
        const output = `${JSON.stringify(summary, null, 2)}\n\n--- Diff ---\n${diffLines.join("\n")}`;
    
        return { content: [{ type: "text" as const, text: output }] };
      }
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully documents the output notation system, but lacks disclosure of edge case behavior (e.g., identical inputs), performance characteristics on large texts, or whitespace handling rules.

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?

Two tightly constructed sentences with zero waste: first states purpose and operation, second documents output syntax. Perfectly sized for the tool's complexity and appropriately front-loaded with the most critical information.

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 the simple two-parameter structure and lack of output schema, the description adequately explains the return value format (diff notation) necessary for interpreting results. It is complete enough for invocation, though it could mention behavior when texts are identical.

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% with clear 'original' and 'modified' labels. The description references 'two strings' which aligns with the parameters, but adds no additional semantic constraints, format requirements, or examples beyond what the schema already provides.

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 specific action (compare two strings) and output type (line-by-line diff), distinguishing it from sibling utilities like text_stats or encoding functions which perform different operations on text.

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?

While it does not explicitly state when-to-use versus alternatives, the explanation of output format symbols ('+' for additions, '-' for deletions) implicitly guides appropriate usage for visualizing textual differences between versions.

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/paladini/devutils-mcp-server'

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