Skip to main content
Glama

convert_to_markdown

Convert PDFs, Office documents, HTML, and images to Markdown, with OCR and optional VLM image descriptions.

Instructions

Convert a document or image to Markdown.

Supports PDF, DOCX, PPTX, HTML, and image files (PNG/JPG/etc.).

Args: source: Local path, HTTP(S) URL, or data URI (data:;base64,...). ocr_languages: Override default OCR languages, e.g. ["en","zh"]. Defaults to env. enable_vlm: If True and a VLM endpoint is configured, generate richer image descriptions via an OpenAI-compatible API. Falls back to OCR text if unavailable. page_range: Optional (start, end) 1-indexed inclusive page range for PDFs. image_caption_mode: How to represent pictures in markdown: - "skip": placeholder only - "ocr_text": picture's OCR'd text (default) - "vlm_description": VLM-generated description (requires enable_vlm)

Returns: ConvertMarkdownResult as dict: {markdown, num_pages, num_tables, num_pictures, source_type, warnings}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
enable_vlmNo
page_rangeNo
ocr_languagesNo
image_caption_modeNoocr_text

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations provided, the description carries full burden and does excellently: it discloses VLM fallback behavior, OCR language override default, page_range inclusivity, and the return result structure. This goes beyond basic facts.

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 description is well-structured: a clear one-sentence purpose, supported formats, then a detailed Args section and Returns section. Every sentence adds value, with no fluff or redundancy.

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 (5 params, 1 required, output schema), the description covers all inputs, explains behavioral nuances, and even describes the return result fields. It is complete and self-sufficient.

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?

Schema coverage is 0%, but the description thoroughly explains each of the 5 parameters, including default values, formats, and meaning (e.g., enable_vlm, page_range, image_caption_mode with its enumerated options). This fully compensates for the bare schema.

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 clearly states the tool converts a document or image to Markdown, listing specific supported formats (PDF, DOCX, PPTX, HTML, images). This distinguishes it from siblings like convert_to_text and extract_tables.

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?

The description provides clear context about what formats and options are supported, and how opts like page_range and image_caption_mode work. However, it does not explicitly compare with siblings (e.g., when to use convert_to_text instead), so it lacks direct exclusions.

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/mk20mm/docling-mcp'

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