Skip to main content
Glama

Parse a document to text

files_parse_document
Read-onlyIdempotent

Extracts text from Word, Excel, PowerPoint or PDF files as page, sheet, slide or section units with paging, so AI can read large documents in parts.

Instructions

Extracts the text of a .docx, .xlsx, .pptx or .pdf as unit ROWS — sections, sheets, slides or pages, never one giant string — plus a manifest accounting for every unit: unitCount, per-unit truncated flags, returnedRange, a reason ("complete" means the document ran out, "maxItems" means units remain), and a cursor to continue with. Give exactly one source: shareUrl (a Teams attachment contentUrl or mail reference-attachment link), driveId+itemId (including remote ids from files_list_shared and teams_get_channel_files_folder), or messageId+attachmentId (a mail file attachment). Spreadsheet formulas come back as their saved values, never evaluated. Friendly errors, never attempts: password/IRM-protected files, scanned PDFs (no OCR here), legacy .doc/.ppt/.xls, files over 16 MiB. Long documents cap at 50 PDF pages and 100k spreadsheet rows per parse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoContinue a previous call: pass its `cursor` verbatim, without any source argument. Carries the source and paging.
itemIdNoItem id within driveId.
driveIdNoDrive id; pass together with itemId.
shareUrlNoA sharing link to parse (Teams attachment contentUrl, mail reference-attachment sourceUrl). Exactly one source: shareUrl, driveId+itemId, or messageId+attachmentId.
messageIdNoMail message id; pass together with attachmentId.
unitLimitNoMost units to return. Defaults to 20.
unitOffsetNoFirst unit (page/slide/sheet/section) to return. Defaults to 0; prefer `cursor` to continue.
attachmentIdNoFile attachment id within messageId.
maxCharsPerUnitNoMost characters per unit. Defaults to 6000; longer units are cut with a marker and flagged.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), and the description adds substantial behavior beyond them: formula values are saved not evaluated, friendly errors for password/IRM, scanned PDFs, legacy formats, and files over 16 MiB, plus hard caps of 50 PDF pages and 100k spreadsheet rows.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but front-loaded: the core behavior (unit rows + manifest) leads, followed by source selection and then limits/errors. It is a long single block, but nearly every clause carries operational value rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description fully carries the return contract (unitCount, per-unit truncated flags, returnedRange, reason codes 'complete'/'maxItems', cursor). Combined with source rules, error exclusions, and caps, an agent has everything needed to invoke and continue correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents each parameter; the description adds meaning on top, notably the 'exactly one source' rule, that cursor carries source and paging, and the truncation behavior tied to maxCharsPerUnit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb and resource: extracts text from .docx/.xlsx/.pptx/.pdf as unit ROWS (sections, sheets, slides, pages) plus a manifest. This clearly differentiates it from the sibling files_read_text by specifying multi-format parsing and unit-based output.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit source-selection rules ('exactly one source: shareUrl, driveId+itemId, or messageId+attachmentId') and names where ids come from (files_list_shared, teams_get_channel_files_folder). However, it never explicitly tells the agent when to prefer this over siblings like files_read_text or files_get_attachment_content.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.