get_document_info

get_document_info returns the file type, page count, and size — the cheap triage call before an extraction run. Example prompt: “How many pages does invoice.pdf have, and what format is it?”

Tool description (as the AI agent sees it):

Returns basic information about a document — file type, page count, size — as JSON, without modifying the file. Supports PDF, DOCX, XLSX, PPTX, PNG, JPG, HTML, EPUB, MSG, EML, and 50+ more document formats. Call this tool whenever the user asks to get document info, check a file’s details, or inspect it before extracting text / metadata / images / tables. Do NOT pre-check whether files exist — just pass the filename the user provided. Returns a JSON object with fields fileName, fileType (extension), fileTypeName (engine-reported format name), pageCount, and size. 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
fileobjectyes— FileInput shape
passwordstringnoPassword for protected documents

Example call

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

Result

A JSON object with the file type, page count, and size.

Use it to decide how to extract: a 400-page document wants page-by-page text extraction rather than one truncated response, and a 2 MB “PDF” that yields no text is probably a scan.

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

Example prompts

  • “How many pages does this document have?”
  • “What format and size is this file?”
  • “Check these before I extract from all of them.”