diff_text
Compare two text strings to generate a unified diff showing additions, deletions, and context lines. Ideal for review agents, changelogs, and patches.
Instructions
Compare two text strings and return a unified diff showing additions (+), deletions (-), and context lines. Returns a unified diff string, or '(no differences)' when inputs are identical. Has no side effects — does not modify either input. Free. Use for review agents, changelog generation, and patch creation. Input is capped at 5000 lines per string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | The "before" text (original). | |
| b | Yes | The "after" text (modified). | |
| context | No | Number of unchanged context lines around each change (default 3, max 10). | |
| label_a | No | Label for the "before" file header (default "a"). | |
| label_b | No | Label for the "after" file header (default "b"). |