Skip to main content
Glama

convert_to_image

Idempotent

Convert Markdown documents to PNG images for visual sharing and embedding. Renders GitHub-Flavored Markdown with tables and math expressions via headless browser screenshot.

Instructions

Convert Markdown to a PNG image. Renders the Markdown as styled HTML (GFM tables, KaTeX math) and takes a full-page screenshot via a headless Chromium browser (Puppeteer). Requires a locally installed Chrome, Edge, or Chromium — set PUPPETEER_EXECUTABLE_PATH env var to override auto-detection. This is a binary format — output_path should almost always be provided. Side effects: launches a transient headless browser process (no persistent state; may fetch KaTeX CDN stylesheet). When output_path is provided, writes the PNG to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns JSON { format: 'png', file_size_bytes, hint, base64_preview }. Returns: JSON write-confirmation (if output_path set), or JSON binary-guidance object (if omitted). Use this when you need a visual snapshot of the rendered Markdown (e.g. for embedding in chat, previews, social cards). Prefer convert_to_pdf for paginated print output, or convert_to_html for interactive web content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdownYesThe raw Markdown source text to convert. Supports GitHub-Flavored Markdown (tables, task lists, strikethrough) and KaTeX math expressions. Pass the full document content as a string, not a file path.
output_pathNoOptional. Absolute or relative file path (e.g. './output.png') where the binary file will be saved. Parent directories are created automatically. If provided, the file is written to disk and a JSON summary with { success, file_path, file_size_bytes, format } is returned. If omitted, a JSON object with { format, file_size_bytes, hint, base64_preview } is returned — the hint will instruct you to call the tool again with output_path to save the file. Binary formats (PNG) should almost always specify output_path.
Behavior5/5

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

Substantially augments annotations by detailing: external dependency requirements (Puppeteer, Chrome executable), runtime side effects (transient browser process, CDN fetching), file system behavior (creates parent directories, overwrites existing), and dual return modes (disk write vs JSON binary-guidance). No contradictions with annotations.

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?

Information-dense and front-loaded (purpose first). Length is justified by complexity (browser dependencies, binary output, two return paths). Minor deduction for slight verbosity in implementation details, but structure is logical: purpose → mechanism → prerequisites → side effects → returns → usage guidance.

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?

Excellent coverage given high complexity and missing output schema. Compensates for no output_schema by exhaustively documenting both return variants (JSON confirmation vs base64_preview object), external system requirements, and behavioral side effects. Sibling differentiation is thorough among 24+ conversion tools.

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?

With 100% schema coverage, baseline is 3. Elevated to 4 by adding critical usage context: 'binary format — output_path should almost always be provided' and explaining the conditional return behavior based on output_path presence, neither of which is obvious from schema alone.

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?

Opens with specific verb+resource ('Convert Markdown to a PNG image') and explicitly distinguishes from siblings ('Prefer convert_to_pdf... or convert_to_html'). Clearly defines scope (GFM tables, KaTeX math) and mechanism (headless Chromium).

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

Usage Guidelines5/5

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

Provides explicit when-to-use ('when you need a visual snapshot... for embedding in chat, previews, social cards') and named alternatives ('Prefer convert_to_pdf for paginated print output'). Also specifies prerequisites (locally installed Chrome/Edge/Chromium).

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/XJTLUmedia/MCP_Markdown_Formatter'

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