extract_text

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.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

extract_text returns the plain text of a document — all of it, or one page with page. The starting point for “what does this say?” across PDF, Office, email, e-book and 50+ other formats. Example prompt: “Extract the text from page 2 of contract.docx.”

Tool description (as the AI agent sees it):

Extracts plain text from a document file. Supports PDF, DOCX, XLSX, PPTX, TXT, HTML, CSV, EML, MSG, RTF, ODT, EPUB, and 50+ more formats. Call this tool immediately whenever the user asks to extract text, read text, or get the content of a document. Do NOT pre-check whether files exist — just pass the filename the user provided. Returns the document’s plain text (truncated with a marker if it exceeds the configured budget). On failure, the response text starts with ‘Text extraction failed for’ followed by the underlying exception type, message, and inner-exception chain.

Parameters

NameTypeRequiredDescription
fileobjectyesThe document — see FileInput shape
passwordstringnoPassword for protected documents
pageintegernoPage number to extract from (1-based). Omit for all pages.

Example call

{
  "name": "extract_text",
  "arguments": {
    "file": {
      "filePath": "contract.docx"
    },
    "page": 2
  }
}

Result

The document’s plain text. Very large outputs are truncated with a marker showing where it stopped — so ask for a specific page when you need a complete read of a long document, and loop over pages rather than requesting everything at once.

On a scanned document this returns little or nothing: there is no text layer to read, and no OCR step. That is a true answer about the file, not a failure — check with get_document_info and, for codes on the page, extract_barcodes.

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

Example prompts

  • “Extract the text from page 2 of contract.docx.”
  • “What does this email say?”
  • “Pull the text out of these PDFs and summarize each one.”
  • “Get the content of page 12 — I only need that section.”

See it used end-to-end: Extract document data with AI agents.