Skip to main content
Glama

extract_markdown

Extract markdown text from PDF or image files, with optional saving to disk as content.md and embedded images.

Instructions

Extract markdown text from a PDF or image file.

When output_dir is provided, saves the extracted markdown to content.md inside a named subdirectory. When include_images is also True, saves embedded images alongside the markdown file. Otherwise returns the markdown text inline.

Args: file_path: Absolute path to the input file (PDF or image) output_dir: Absolute path to an existing output directory (must be within allowed dir). When set, saves markdown to disk at <output_dir>/<file_stem>/content.md. include_images: When True (requires output_dir), save images to disk and rewrite markdown with relative image links.

Returns: When output_dir is not set: result: Extracted markdown content When output_dir is set (with or without images): output_directory: Absolute path to the output subdirectory markdown_file: Absolute path to the content.md file images: List of saved image filenames (empty if include_images is False)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
output_dirNo
include_imagesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
imagesYes
resultYes
markdown_fileYes
output_directoryYes
Behavior5/5

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

Without annotations, the description thoroughly discloses side effects: saving markdown to disk, saving embedded images, rewriting relative links, and requiring output_dir for include_images. It also documents the conditional return structure, giving the agent full visibility into tool behavior.

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

Conciseness5/5

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

The docstring is well-organized into a summary, Args, and Returns sections, with no unnecessary filler. Every sentence adds essential information about the tool's behavior and return values.

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?

Given the tool's complexity and lack of output schema in view, the description provides a complete account of all possible return values and parameter interactions. It covers both modes (inline vs. file output) and the image handling behavior, leaving minimal ambiguity for the agent.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by explaining file_path as an absolute path, output_dir as an existing directory within allowed bounds, and include_images as a dependent flag. This adds significant meaning beyond the bare schema type and defaults.

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?

The description begins with a clear action ('Extract markdown text') and specific source ('PDF or image file'), establishing the tool's purpose. It implicitly distinguishes from sibling tools like extract_markdown_from_url by emphasizing local file paths.

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?

Provides clear context for when to use the tool (local PDF or image files) and detailed guidance on parameter combinations (output_dir, include_images). However, it does not explicitly mention when to prefer alternative sibling tools like extract_markdown_from_url or extract_markdown_advanced.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ORDIS-Co-Ltd/mistral-ocr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server