get_document_info

get_document_info tells the agent what it is about to edit: the format family (WordProcessing, Spreadsheet, Presentation, FixedLayout for PDF, Textual, Ebook, Email), the number of pages — worksheets for a workbook, slides for a presentation — whether it is password-protected, and which formats it can be saved to. Example prompt: “How many worksheets does budget.xlsx have?”

Tool description (as the AI agent sees it):

Inspects a document before editing it: its format family, format, number of pages (worksheets for spreadsheets, slides for presentations), size, whether it is password-protected, and which formats it can be saved to. Supports DOCX, DOC, RTF, ODT, XLSX, XLS, ODS, CSV, PPTX, PPT, ODP, PDF, TXT, HTML, XML, Markdown, EPUB, MOBI, EML, MSG and more. Call this first when the user asks how many pages, worksheets or slides a document has, or whether it can be edited. Do NOT pre-check whether files exist — just pass the filename the user provided; a missing file returns the list of available files. Returns JSON: { fileName, family, format: { name, extension, mime }, pageCount, size, isEncrypted, infoType, canEdit, canSaveTo[] }. family is one of WordProcessing, Spreadsheet, Presentation, FixedLayout, Textual, Email, Ebook. On failure isError is set and the text starts with ‘Document-info lookup failed for’; a file that cannot be found returns the list of available files instead.

Parameters

NameTypeRequiredDescription
fileobjectyes— FileInput shape
passwordstringnoPassword, for password-protected documents

Example call

{
  "name": "get_document_info",
  "arguments": {
    "file": {
      "filePath": "budget.xlsx"
    }
  }
}

Result

JSON — captured from server 26.10.0:

{
  "fileName": "budget.xlsx",
  "family": "Spreadsheet",
  "format": {
    "name": "Office Open XML Workbook Macro-Free (XLSX)",
    "extension": "xlsx",
    "mime": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  },
  "pageCount": 3,
  "size": 6099,
  "isEncrypted": false,
  "infoType": "SpreadsheetDocumentInfo",
  "canEdit": true,
  "canSaveTo": [ "xlsx", "xls", "xlsm", "xlsb", "xltx", "xltm", "xlt",
                 "ods", "csv", "tsv", "pdf", "xps", "txt", "mhtml" ]
}
FieldMeaning
familydecides which parameters apply: worksheet for Spreadsheet, slide for Presentation, pages for FixedLayout (PDF)
pageCountpages — or worksheets, or slides
isEncryptedtrue means the tools need password
canSaveTovalid format values for replace_text and save_from_html

On failure the text starts with Document-info lookup failed for and isError is set.

Example prompts

  • “How many worksheets does budget.xlsx have?”
  • “Is this PDF password-protected?”
  • “What can I save this presentation as?”