unified_diff
Computes a unified diff between two files, using difflib for small files and SHA-256 chunk comparison for large ones. Returns structured diff output without modifying files.
Instructions
Compute a unified-style diff between path_a and path_b.
For small files (<= 8 MiB per side) the function runs
difflib.unified_diff over the byte streams (decoded
as latin-1). For large files it falls back to a
per-chunk SHA-256 diff.
Args: path_a: first file (the "before" or "original") path_b: second file (the "after" or "patched")
Returns::
{
"path_a": "...",
"path_b": "...",
"size_a": N,
"size_b": N,
"mode": "sha256_equal" | "inline_unified_diff" | "chunk_sha256_diff",
"equal": bool,
"diff_lines": ["...", ...], (inline mode)
"chunk_diff": [{...}, ...], (chunk mode)
}The function is read-only. The "patched" copy at path_b is not modified.
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": {
"path_a": "<path_a>",
"path_b": "<path_b>"
},
"name": "unified_diff"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path_a | Yes | ||
| path_b | Yes |