analyze_changes

analyze_changes returns the differences between two documents as structured data, without producing a marked-up file. It is the cheaper half of the pair: no rendering, no saved output. Example prompt: “What changed between these two versions?”

Tool description (as the AI agent sees it):

Analyzes the differences between two documents and returns them as structured data, WITHOUT producing a marked-up result file. Supports PDF, DOCX, XLSX, PPTX, ODT, RTF, TXT, HTML, and 30+ more document formats. Call this tool whenever the user wants to know WHAT changed between two files — to summarize, explain, list, or reason about the differences — rather than to obtain the rendered comparison document. This is cheaper than compare because it skips rendering and saving the result file; use compare instead when the user needs that file to view, download, or share. Do NOT pre-check whether files exist — just pass the filenames the user provided. The tool resolves files from storage and returns an error with available files if a name is not found. The returned text starts with either <N> change(s) detected or No changes detected, followed by a Changes: section containing a JSON array describing each change (type, component, page, the specific changed fragment changedText, surrounding source/target text, table cell, style changes). On failure, the response text starts with ‘Analyze failed for’ followed by the underlying exception type, message, and inner-exception chain.

Parameters

NameTypeRequiredDescription
sourceFileobjectyesSource (original) document — provide the filename as given by the user, e.g. ‘source.pdf’ — FileInput shape
targetFileobjectyesTarget (modified) document to compare against — provide the filename as given by the user, e.g. ’target.pdf’ — FileInput shape
sourcePasswordstringnoPassword for source document, if password-protected
targetPasswordstringnoPassword for target document, if password-protected

Example call

{
  "name": "analyze_changes",
  "arguments": {
    "sourceFile": {
      "filePath": "contract-v1.docx"
    },
    "targetFile": {
      "filePath": "contract-v2.docx"
    }
  }
}

Result

Text beginning with <N> change(s) detected (or No changes detected), followed by a Changes: section containing the same JSON array compare returns — type, component, page, changedText, surrounding source and target text, table cell, and style changes — but no result file is written.

This is what an agent should use to summarize, explain, or reason about a revision. It is also the right tool inside loops: analysing twenty file pairs costs far less than rendering twenty marked-up documents nobody opens.

On failure the text starts with Analyze failed for, followed by the exception type and message.

Example prompts

  • “What changed between contract-v1.docx and contract-v2.docx?”
  • “Summarize the differences and flag anything about payment terms.”
  • “Did the liability clause change between these two versions?”
  • “List only the deletions between the draft and the final version.”

See it used end-to-end: Summarize what changed.