{"uid":"cap_JnVPiBJRK5TQsq0ycCYsK","slug":"agenttools-text-diff-lcs-unified-diff-be400efc","name":"AgentTools Text Diff (LCS Unified Diff)","description":"Compare two texts line by line using an LCS diff: exact additions, removals and context — in unified-diff style. Deterministic, unlike asking a model to 'find the differences'. Use this when an agent needs to exact line-level diff with unified-style output.","url":"https://agentstoolshub.com/api/v1/dev/diff?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","description":"Use \n for line breaks"},"b":{"type":"string","description":"Changed text"},"context":{"type":"number","description":"Context lines"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_MVoh-OPb-j_1l53ndw8Rn","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes a deterministic line-by-line LCS diff between two texts and returns the result in unified-diff format with additions, removals, and context lines.","exampleAgentPrompt":"Can you diff these two versions of my config file line by line and show me exactly what changed? Original: 'host: localhost\nport: 8080\ndebug: true' and updated: 'host: prod.example.com\nport: 443\ndebug: false' — give me 2 lines of context around each change.","exampleUseCases":[{"title":"Code review change detection","prompt":"I have two versions of a Python function — the original and the refactored one. Can you compare them line by line and show me exactly which lines were added or removed, with 3 lines of context? Original: 'def add(a, b):\n    return a + b' and new: 'def add(a, b, c=0):\n    \"\"\"Add two or three numbers.\"\"\"\n    return a + b + c'"},{"title":"Config file drift audit","prompt":"These are two versions of our nginx.conf — before and after a deployment. Diff them line by line in unified format with 1 line of context so I can see exactly what the ops team changed: before: 'worker_processes 1;\nevents {}\nhttp { listen 80; }' and after: 'worker_processes 4;\nevents { multi_accept on; }\nhttp { listen 443 ssl; }'"},{"title":"Document revision tracking","prompt":"Compare these two drafts of our press release and tell me exactly which lines were added and which were removed — no guessing, I need the precise line-level diff. Draft 1: 'We are excited to announce our new product.\nIt launches in Q3.\nContact us at info@company.com.' Draft 2: 'We are thrilled to announce our flagship product.\nIt launches in Q2 2025.\nVisit our website for details.'"}],"resultDescription":"Returns a unified-diff formatted string showing line-level changes between the two input texts: lines prefixed with '+' for additions, '-' for removals, and ' ' (space) for unchanged context lines, along with standard unified-diff hunk headers indicating line positions.","failureModes":["Missing required parameters 'a' or 'b' returns an error","Extremely large text inputs may be truncated or time out","Non-text or binary content passed as strings may produce garbled output","Invalid context value (non-numeric) may cause a bad request error"],"whenToPreferThis":"Choose this endpoint when you need a deterministic, exact line-level diff in standard unified-diff format — particularly when you cannot rely on a language model to accurately enumerate every changed line. Ideal for comparing code, configuration files, structured text, or any content where precision and reproducibility matter. Prefer this over asking a model directly when the texts are long, changes are subtle, or auditability is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T12:50:52.037Z","isFirstParty":false,"canonicalSlug":"agenttools-text-diff-lcs-unified-diff-be400efc"}