Skip to main content
Glama

convert_to_md

Idempotent

Save Markdown to files with optional formatting normalization, or return standardized text with consistent syntax for headers, lists, and code blocks.

Instructions

Export Markdown content, optionally harmonizing its formatting first. When harmonize=false (default), returns the input Markdown unchanged. When harmonize=true, applies the same normalization as harmonize_markdown (ATX-style headers, '-' list markers, fenced code blocks, consistent indentation) before returning. Side effects: when output_path is provided, writes the Markdown to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the Markdown string directly. Returns: Markdown string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this when you want to save Markdown to a file (with or without cleanup). Prefer harmonize_markdown if you only want to normalize formatting without saving to disk. Use the convert_to_* family for other output formats.

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.
harmonizeNoOptional. When true, normalizes Markdown syntax (ATX headers, '-' list markers, fenced code blocks, consistent indentation) before returning or saving. When false or omitted, the Markdown is passed through unchanged. Defaults to false.
output_pathNoOptional. Absolute or relative file path (e.g. './output.txt') where the result will be saved. Parent directories are created automatically. If omitted, the converted text content is returned directly in the response as a string. If provided, the file is written to disk and a JSON summary with { success, file_path, file_size_bytes, format } is returned instead.

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