Skip to main content
Glama

harmonize_markdown

Idempotent

Normalize Markdown formatting by converting headers to ATX style, standardizing list markers to dashes, and enforcing fenced code blocks. Returns consistent syntax or saves to file.

Instructions

Standardize and normalize Markdown syntax without changing the document's meaning. Re-formats headers (ATX-style), normalizes list markers to '-', enforces fenced code blocks with backticks, and applies consistent indentation. Side effects: when output_path is provided, writes the harmonized Markdown to disk (creates parent directories as needed, overwrites existing files). When output_path is omitted, returns the harmonized text as a string with no file I/O. Returns: harmonized Markdown string (if no output_path), or JSON with { success, file_path, file_size_bytes, format } (if output_path set). Use this tool when you need to clean up inconsistent Markdown formatting before further processing. Prefer convert_to_md with harmonize=true if you also need to save the result, as it combines both steps. Not suitable for converting Markdown to other formats — use the convert_to_* tools instead.

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.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