get_document_info

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

get_document_info returns the file type, page count, size, and per-page dimensions — without touching the annotations. Agents use it to check page numbers before annotating and to size coordinates sensibly. Example prompt: “How many pages is this, and how big is page 1?”

Tool description (as the AI agent sees it):

Returns file type, page count, size, and per-page dimensions for a document as JSON. Supports PDF, DOCX, XLSX, PPTX, and 50+ more document and image formats. Call this tool whenever the user asks for document info, page count, size, dimensions, or wants to inspect a document before annotating. Do NOT pre-check whether files exist — pass the filename the user provided directly. Returns a JSON object with fileType, pageCount, size, and pages (array of per-page width/height when available). 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
fileobjectyesThe document — see FileInput shape
passwordstringnoPassword for protected documents

Example call

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

Result

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

Per-page dimensions matter more here than in other servers: x/y on add_annotation are document coordinates, so knowing the page box is what keeps an annotation on the page.

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

Example prompts

  • “How many pages does contract.pdf have?”
  • “What are the page dimensions — I want to place a note in the top-right corner.”
  • “Is this a PDF or a Word file?”