diff_documents
Compare two documents in any supported format and return their differences, including cross-format comparisons, as unified text or JSON.
Instructions
Compare two documents and return their differences.
Each input is auto-detected (file path, data URI, base64, or inline content), so documents in any supported format can be compared — even across formats (e.g. a DOCX against its PDF export).
Returns a dictionary with:
diff: the rendered diff (unified text or JSON string)
has_changes: whether any differences were found
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new | Yes | Updated document: file path (within read allowlist), data URI, base64, or inline content. REQUIRED. | |
| old | Yes | Original document: file path (within read allowlist), data URI, base64, or inline content. REQUIRED. | |
| format | No | Output format: 'unified' (default, plain text) or 'json' (structured). | unified |
| granularity | No | Comparison granularity: 'block' (default), 'sentence', or 'word'. | block |
| context_lines | No | Context lines around changes in unified output (default: 3). | |
| ignore_whitespace | No | Normalize whitespace before comparing. Default: false. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||