get_document_info

get_document_info returns the file type, page count, size, and per-page dimensions without modifying anything. It is the natural precondition check: how many pages are there, and are these files even the same format? Example prompt: “How many pages does each of these have?”

Tool description (as the AI agent sees it):

Returns the file type, page count, size, and per-page dimensions of a document as JSON, without modifying the file. Supports PDF, DOCX, XLSX, PPTX, and 30+ more document formats. Call this tool whenever the user asks to inspect a document, check its page count, or get its details — useful as a precondition check before Merge or Split (e.g. ‘how many pages does this PDF have?’). Do NOT pre-check whether the file exists — just pass the filename the user provided. Returns a JSON object with fields fileName, fileType, fileFormat, extension, pageCount, size, and pages (array of { number, width, height, visible }). On failure, the response text starts with ‘Document-info lookup failed for’ followed by the underlying exception type, message, and inner-exception chain.

Parameters

NameTypeRequiredDescription
fileobjectyesFileInput shape
passwordstringnoPassword for protected documents

Example call

{
  "name": "get_document_info",
  "arguments": {
    "file": {
      "filePath": "report.pdf"
    }
  }
}

Result

A JSON object with fileName, fileType, pageCount, sizeBytes, and pages (width and height per page).

Two things it prevents: asking split for a page that does not exist, and merging a DOCX into a set of PDFs because nobody checked the extensions.

On failure the text starts with Document-info lookup failed for, followed by the exception type and message.

Example prompts

  • “How many pages does each of these documents have?”
  • “Are these all PDFs?”
  • “What is the page size of this document?”