import_annotations

import_annotations merges annotations into a document from a source — either an XML file produced by export_annotations, or another annotated document. This is how a round of comments survives a new draft, and how several reviewers’ copies are combined. Example prompt: “Apply the comments from the old draft to the new one”.

Tool description (as the AI agent sees it):

Imports annotations from another source (an XML annotations file or an annotated document) and saves the merged document back to storage. Supports PDF, DOCX, XLSX, PPTX, and 50+ more document and image formats for the target. Source must be either an XML file produced by export_annotations, or another annotated document of the same engine format. Call this tool whenever the user asks to import, merge, or apply annotations from one document to another. Do NOT pre-check whether files exist — pass the filenames the user provided directly. Returns a saved-path message (‘Imported annotations from into ’). On failure, the response text starts with ‘Annotation import failed for’ followed by the underlying exception type, message, and inner-exception chain.

Parameters

NameTypeRequiredDescription
fileobjectyesFileInput shape
sourceobjectyesSource file containing annotations to import — an XML file (.xml) or an annotated document (.pdf, .docx, etc.). — FileInput shape
passwordstringnoPassword for protected target documents

Example call

{
  "name": "import_annotations",
  "arguments": {
    "file": {
      "filePath": "contract-v2.pdf"
    },
    "source": {
      "filePath": "contract-v1-annotations.xml"
    }
  }
}

Result

A message of the form Imported annotations from <source> into <file>, naming the merged document.

The source document must be the same engine format as the target — annotations from a PDF go into a PDF. Coordinates come across as-is, so on a re-flowed draft an imported note may land near, rather than exactly on, the text it referred to.

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

Example prompts

  • “Apply the comments from the old draft to the new version.”
  • “Merge the annotations from both reviewers into one copy.”
  • “Import the annotations XML into this document.”