Skip to main content
Glama

read_document_as_markdown

Convert PDF, Word, PowerPoint, HTML, EPUB, email, spreadsheets, and 200+ text formats into Markdown, with optional section extraction for targeted reading.

Instructions

Read a document and convert it to Markdown format (simplified API).

Supports PDF, Word (DOCX), PowerPoint (PPTX), HTML, email (EML), EPUB, Jupyter Notebooks (IPYNB), Excel (XLSX/CSV), ODF formats, and 200+ text formats.

The source parameter is auto-detected as:

  • File path (if file exists in read allowlist)

  • Data URI (data:image/...)

  • Base64-encoded content (auto-detected)

  • Plain text content (HTML, Markdown, etc.)

Optionally extract a specific section by providing the section parameter with a heading name (case-insensitive match).

Image inclusion and markdown flavor are configured at server startup and cannot be changed per-call.

Returns the Markdown as a text content block, followed by an image content block for each image found (when include_images=true), so vision models can see the images alongside the text. When include_images=false, only the text, with image alt text in place of the images.

Input Schema

NameRequiredDescriptionDefault
sourceYesUnified source parameter. Auto-detected as: file path (if exists in read allowlist), data URI (data:...), base64 string, or plain text content. REQUIRED.
sectionNoOptional section name to extract (case-insensitive heading match). If provided, only that section is returned.
pdf_pagesNoPage specification for PDF sources only. Examples: '1-3' (pages 1-3), '1,3,5' (specific pages), '1-3,5,10-' (ranges and individual pages), '1-' (from page 1 to end).
format_hintNoOptional format hint for ambiguous cases (e.g., extensionless files). Options: auto (default), pdf, docx, pptx, html, eml, epub, ipynb, odt, odp, ods, xlsx, csv, rst, markdown, txt.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.19.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does well: it discloses the read-allowlist constraint on file paths, that image inclusion and markdown flavor are fixed at server startup and cannot be changed per call, and that section matching is case-insensitive. It also describes the response shape (a text content block followed by one image block per image, or alt-text placeholders when include_images=false), which no output schema covers. Only error behavior and size/rate limits are unaddressed.

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?

Front-loaded with the purpose, then formats, then source detection, then optional behaviors, then return shape — a sensible ordering for an agent scanning it. The long format enumeration and the repeated source auto-detection list (already in the schema) are the main slack, but they remain short and skimmable.

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

Completeness4/5

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

For a four-parameter read tool with no annotations and no output schema, the definition covers input handling, configuration constraints, and return structure, which is enough to invoke it correctly. The only meaningful omission is what happens on failure (unreadable file, unsupported format, no matching section).

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

Parameters3/5

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

Schema description coverage is 100%, so all four parameters are already documented, and the description largely restates the source auto-detection rules and the section heading match. It adds no meaning for pdf_pages or format_hint, which live entirely in the schema, so the baseline of 3 applies.

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

Purpose4/5

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

States a specific verb and resource ('Read a document and convert it to Markdown format') plus the full set of supported input formats, so the agent knows exactly what the tool produces. It does not explicitly contrast itself with the closest sibling, get_document_outline, which returns structure rather than full content, so an agent must infer that boundary.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the description says you may 'optionally extract a specific section' and explains how the source is auto-detected, which guides parameter choice. It never says when to prefer this over search_documents, diff_documents, or get_document_outline, and gives no exclusions or prerequisites beyond the read-allowlist note.

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