export_annotations

export_annotations writes a document’s annotations out as an XML file, separate from the document itself. That file can be archived, diffed, or fed back in with import_annotations. Example prompt: “Export the review comments so I can keep them with the case file”.

Tool description (as the AI agent sees it):

Extracts annotations from a document and saves them as an XML file (suitable for re-import via import_annotations). Supports PDF, DOCX, XLSX, PPTX, and 50+ more document and image formats. Call this tool whenever the user asks to export, extract, serialize, or save annotations to XML. Do NOT pre-check whether files exist — pass the filename the user provided directly. Returns a saved-path message (‘Exported N annotation(s) from to .annotations.xml’). On failure, the response text starts with ‘Annotation export failed for’ followed by the underlying exception type, message, and inner-exception chain.

Parameters

NameTypeRequiredDescription
fileobjectyesFileInput shape
passwordstringnoPassword for protected documents

Example call

{
  "name": "export_annotations",
  "arguments": {
    "file": {
      "filePath": "contract_annotated.pdf"
    }
  }
}

Result

A saved-path message naming the XML file written to your output folder.

The pair export/import is how annotations move between copies of a document: export from the reviewed copy, import into the revised one, and a round of comments survives a new document version.

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

Example prompts

  • “Export the review comments to XML for the case file.”
  • “Save the annotations separately so I can re-apply them to the new draft.”