get_document_edoc
Download or inspect a document's raw electronic file (edoc) from Laserfiche. Three modes: info (metadata), bytes (base64), or text (extracted from PDFs).
Instructions
Download or inspect a document's raw electronic file (edoc).
The recommended path for reading document content on v1 servers
(get_document_text has no endpoint to call there). Three modes
trade off cost vs. depth:
Args:
entry_id: Integer entry ID. Must point to an electronic document,
not a folder.
mode:
"info" (default) — fetches the edoc but returns only its
size and content-type, plus a hint. No bytes enter the model's
context. Cheapest; safe to call on anything as a first probe.
``"bytes"`` — returns the edoc as base64-encoded bytes plus
content-type and size. Refused if the edoc exceeds
``LF_EDOC_MAX_BYTES`` (default 25 MB) — see ``max_bytes``.
``"text"`` — extracts readable text server-side:
- ``application/pdf`` → pypdf, page by page, truncated to
``text_char_limit``. Response includes ``pages_total``,
``pages_extracted``, ``truncated``.
- ``text/*`` → decoded directly as UTF-8 (replacement chars
on bad bytes).
- Anything else (.docx, .xlsx, images, etc.) → structured
error naming the content-type and suggesting ``mode="bytes"``
for client-side handling. OCR is not attempted.
- Encrypted or malformed PDFs → structured error with the
underlying exception class.
max_bytes: Per-call override for ``LF_EDOC_MAX_BYTES``. Use to
raise the cap for a specific large document without changing
the server-wide default.
text_char_limit: Truncate extracted text after this many
characters (default 50,000). Truncation is signalled by the
``truncated`` field, NOT a marker in the text itself.Returns: Always a dict. Shape depends on mode — see above.
On size-cap refusal, response contains error="size_exceeds_cap"
plus byte_size and max_bytes so the LLM can decide whether
to raise the cap and retry.
On failure: returns {"mode": "error", "error": <slug>, "entry_id": <int>, ...}. Common slugs: not_found (entry is a
folder, or has no edoc), auth_failed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entry_id | Yes | Entry ID of an electronic document (not a folder). | |
| mode | No | 'info' (default): metadata only, no bytes returned. 'bytes': base64 payload, capped by max_bytes / LF_EDOC_MAX_BYTES. 'text': server-side extracted text — PDF via pypdf, text/* decoded directly, other types return unsupported_content_type. OCR is not attempted. | info |
| max_bytes | No | Per-call override for LF_EDOC_MAX_BYTES (default 25 MB). Only applies to mode='bytes' and 'text'. | |
| text_char_limit | No | Truncate extracted text after this many characters (mode='text' only). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||