Documents

Folders, facts search, live documents, uploads.

Raw Markdown for agents: documents.md. MCP: read_docs("documents").

A Space is a data room: folders and documents, plus the facts the extraction pipeline derives from every processed document. documents.ls lists a Space at a POSIX-style path, each file with its status, hash and updated_at (the hash covers the extracted text and stays null until the status is PROCESSED); documents.space_contents and documents.folder_contents list folders and documents; documents.folders_list lists every folder with counts. documents.get returns one document's metadata and processing status.

Facts: documents.facts_grep searches a Space's extracted facts (BM25 or regex), documents.facts_cat returns the facts of one document, documents.facts_read pages through all facts with the current summary and failed or pending extractions. spaces.summary returns the generated Space summary. Use these to answer questions about document content instead of downloading files. data.read returns the text of a document (Markdown of a live document, OCR or extracted text of an upload; read_docs("data")) and data.grep searches it. The in-app assistant calls a facts_* operation for the document first, or passes force=true to data.read.

Document types: a document recognised as a known type carries fixed fact keys, the same for every issuer, so one query works across documents. Invoices use document.number, document.issue_date, supplier.name, supplier.tax_id, customer.name, totals.payable, tax_N.amount and line_item_N.description, line_item_N.quantity, line_item_N.total; statements use account.number, period.from, period.to, summary.balance and transaction_N.date, transaction_N.amount. N counts from 1. Labels without a field of their own are kept under other.<label>. totals.reconciled and summary.reconciled say whether the amounts add up. documents.types.list returns the types the LLM reads, with all of their keys. Pass document_type (for example invoice) to documents.facts_read or documents.facts_grep to stay within one type; every fact carries document_type, empty when the document was read without a type and its keys are free-form. Known formats (DIAN UBL invoices, Bancolombia and Nequi statements) are parsed deterministically without OCR or an LLM; other documents of a known type are read by the LLM against the type's keys. documents.jobs_list shows the path in extractor (for example dian_ubl@2) and in route (deterministic, profile, parser_failed_fallback, profile_failed_fallback or generic), with the parsers and types considered in classification. documents.parsers.list shows the known formats and what each one recognizes.

Password-protected PDFs: an admin stores the password of a format with documents.parser_passwords.set; each user can also store one general password (usually their id number) with documents.parser_passwords.general.set, tried on every encrypted PDF that user uploads after the password of the format. documents.parser_passwords.general.get says whether one is set, never its value. A PDF the general password unlocks but no known format recognizes fails with parser_failed_decrypted_no_ocr unless the user passed allow_ocr=true, which lets OCR read the unlocked copy (the document then carries the ocr:decrypted_upload warning).

Organising: documents.folder_create_many (formerly folders_create) builds a folder tree from paths like "Contracts/2026/Q1" in one call, documents.folder_create makes one folder; documents.folder_rename, documents.move, documents.bulk_move, documents.rename. Deleting (documents.delete, documents.bulk_delete, documents.folder_delete, spaces.clean) is irreversible. Delete many documents with one documents.bulk_delete or documents.folder_delete, not one documents.delete per document. A folder with more than 500 documents answers outcome 'queued' and empties in the background. When a delete times out or the gateway answers 502, the work may have finished: repeat the call with the same idempotency_key, which returns the original result instead of acting twice.

Live documents: documents.live_create makes a collaborative markdown document, sheet, database (task board) or whiteboard. An uploaded or saved .xlsx, .xlsm or .csv becomes a live sheet and an .md or .txt a live Markdown document once it is processed (the document then has live_content_type and a source with its format); edit it like any live document, and documents.download returns it in its original format, rebuilt from the original file. An imported workbook keeps its structure: cells and formats change, rows only append and its sheets keep their names; a CSV file has one tab. Such documents cannot be replaced; edit them. Markdown is read with data.read and written with data.write: patch steps on the current text, the whole text, or a new document at a path (read_docs("data")). Sheets have tabs: documents.sheet_read returns the tabs, the rows and row_order of one tab (tab_id, default the first) and a content_hash over all tabs; documents.sheet_edit changes cells and the row order of one tab (pass the hash back as expected_content_hash); with tab_id and tab_name it creates that tab if missing or renames it, in the same call as its cells. documents.live_save consolidates and re-extracts facts. Sheet formats go with documents.sheet_edit and show in the editor and the xlsx export. formats is a list of {range, style} patches: ranges are a cell B2, cells A1:N40, whole columns K:K or A:C, whole rows 2:5; style takes bold, italic, underline, strike (true), font_color and fill_color ("#RRGGBB"), align (left, center, right), number_format (Excel code: "#,##0.00", "0%", "dd/mm/yyyy") and borders ({top, right, bottom, left}: {style: thin, medium, thick, dashed, dotted or double, color}). A property set to null is removed, style null clears the range. Format whole columns with K:K, not with a cell range: a column format also covers rows added later and patches the cells already formatted in it. conditional_formats replaces the tab's rules ([] removes them); ranges are whole columns from an optional start row (K:K, A2:N) and the earlier rule wins. A rule is when + style, e.g. {range: "K2:K", when: {op: "lt", value: "30"}, style: {font_color: "#C00000"}}, with when.column to test another column of the same row (color the row A2:N when L < 30: when: {op: "lt", value: "30", column: "L"}), text ops such as {op: "contains", value: "pending"} or {op: "empty"}, or a color scale {range: "K2:K", scale: {min_color: "#F8696B", max_color: "#63BE7B"}}. gt, gte, lt, lte and between only match numbers (1234.5, no thousands separators); eq and neq also compare text, ignoring case. documents.sheet_read with include_formats=true returns both. To link an image stored in Adlass, write its document path /spaces/<space_id>/documents/<id> as the cell value: the editor shows an image icon and previews it on hover. The content_hash covers values only: expected_content_hash does not protect formats. Databases: documents.database_read returns the rows as items in display order, each with its row_id, plus total and next_cursor: page with limit and cursor=next_cursor, pass fields (["title", "status"]) to skip long cells and row_ids to read a few rows; then documents.database_rows_create for several rows in one call (rows: [cells, ...], one content_hash check), documents.database_row_create for one, documents.database_row_update ({"status": "done"} moves a task), and documents.database_row_delete. Person cells such as assignee take a member's user id or email from spaces.members. documents.database_row_comment_create adds a comment to a task (progress notes, plans); documents.database_read returns them under comments, per row. documents.database_options_set sets the options of a select property, e.g. the status columns of a board: the complete new list in order, items with the id of an existing option rename or move it, items without id add one; names unique, at most 6 for the property the board groups by, and an option rows still use cannot be removed. An id property (type id) gives every row a key such as N1APP-621, like a Jira issue key: the server numbers each new row (from the app, the API or this MCP), never reuses a number and never lets a write set or change it. documents.database_id_property_set adds it (rows titled PREFIX-<n> keep n, the rest continue after the highest) or changes its prefix, which only changes how keys are shown. documents.database_read returns the keys with their prefix and keys (["N1APP-618"]) reads those rows. Whiteboards (content_type application/vnd.adlass.live-whiteboard) are read with documents.whiteboard_read and changed with documents.whiteboard_edit; data.read returns their outline as Markdown. Read read_docs("whiteboard") first.

Uploads need the browser or a client that can PUT bytes: documents.upload_initiate registers metadata (pass content_type when you know it; otherwise it is inferred from the file extension), documents.upload_url mints a PUT URL and returns recommended_headers (Content-Type), the file is uploaded by the client, then documents.upload_confirm reads the file at a reading level: the call's reading, else the organization's default (document_reading of each workspace in get_context account.tenants; documents.reading.set changes it, only when the user asks and only as an admin).

  • code (the factory default): text by code only, free. Text, Markdown, CSV/JSON/XML, Excel, Word, PowerPoint, OpenDocument and PDFs with a text layer get their text; scans and photos stay without text, a PDF with scanned pages keeps only its text layer (job warning ocr_disabled for both), and images are only stored.
  • ocr: plus Mistral OCR for what code cannot read, images included (document.page, 8 credits per page; a PDF with one scanned page goes to Mistral whole).
  • facts: plus the AI facts pass (document.extraction, token cost). The current rates of document.page and document.extraction for the payer come from billing.rates.list. Parsers (DIAN invoices, bank statements) add their facts at every level, free. Each document shows text_source (native, code, ocr or null: no text) and facts_source (parser, ai or null: no facts). documents.reprocess(document_id, reading) reads a PROCESSED upload again at a higher level, e.g. ocr for a scan stored without text. Images that are only stored keep WebP previews (documents.download variant thumb or display). A file behind a public http(s) URL is one call: documents.import_url(space_id, source_url, folder_id?, file_name?) fetches it (up to 10 MB) and confirms it like an upload. New version of a file: documents.replace_initiate(document_id, file_size) returns a PUT ticket and an upload_token; PUT the bytes, then documents.replace_confirm(document_id, upload_token). The document keeps its id, name, folder, sharing and record links; content_version goes up, the old file, text and facts are dropped and the new file is extracted again. Never upload the same file a second time to replace it.

Small text files: documents.replace_text(document_id, content, if_hash?) replaces the whole text of an uploaded CSV, TSV, TXT, MD or JSON file in one call (at most 1 MB) with the same versioning and extraction; read the current text first with data.read (the file as it is) and pass its hash as if_hash. Fewer calls: documents.upload_initiate with include_upload_url=true returns the PUT ticket as upload (skips upload_url); for many files documents.upload_initiate_many (up to 50 per call, tickets in items[i].upload, one failed item does not stop the rest) and documents.upload_confirm_many. PUT the files of a batch in parallel (about 10 at a time), not one after another: each PUT is a round trip to storage, so 50 files take seconds instead of most of a minute. A replayed idempotency_key returns no ticket: call documents.upload_url. Sending Content-Type is advised, not required: the URL does not sign it, and extraction never reads the type stored on the object. It decides in this order: the file's own byte signature, then the content_type declared at upload_initiate, then the file extension. If a document ends FAILED, documents.get returns processing_error with code, message and hint (for example unsupported_file_type: upload again with a supported extension and its content_type). For a FAILED upload whose cause is gone (transient provider error, a PDF password stored afterwards with documents.parser_passwords.general.set, credits topped up), documents.reprocess queues a new extraction without uploading again; poll documents.jobs_get. Offer the user the upload area with navigate instead of uploading yourself. documents.download and documents.download_bulk mint presigned URLs; never show those URLs in the chat. They are gated: navigate to the document (or the Space's documents area) first, or pass force=true, or the call is rejected. documents.preview_sheet returns the first sheet of an uploaded .xlsx/.xlsm as a bounded grid (500 rows x 50 columns, cached formula values, no other sheets) for the in-app viewer; use documents.download for the whole file.

Files in official formats: documents.export converts a document (document_id), inline markdown, inline html or a table into pdf, docx, xlsx, csv, html or md and returns a temporary download URL; nothing is stored. Only when the user asks to keep the file, call documents.export_save, which adds it to a Space as a new document you can link to; a saved xlsx, csv or md becomes a live document there. Text exports as pdf/docx/html/md, tables as xlsx/csv/pdf/docx/html; tables over 2,000 rows only as xlsx or csv.