Skip to main content
Glama

convert_to_json

Idempotent

Convert Markdown to structured JSON for programmatic analysis. Transforms documents into hierarchical objects with sections, headings, paragraphs, and code blocks to enable automated processing and system integration.

Instructions

Convert Markdown to a structured JSON representation. Parses the document into a JSON object with the document title as the root key, containing arrays of section objects with headings, paragraphs, lists, code blocks, and tables. Useful for programmatic analysis or feeding structured content into other systems. Side effects: when output_path is provided, writes the JSON to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the JSON string directly. Returns: JSON string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this when you need a machine-readable AST-like representation of the Markdown content. Prefer convert_to_xml for XML-based interchange, or convert_to_csv/convert_to_xlsx for tabular data extraction.

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.
titleNoOptional. A document title string. Used as the root element name or document metadata title in the output. Defaults to 'document' if omitted.
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.
Behavior4/5

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

Annotations indicate readOnly=false and idempotent=true; the description adds valuable behavioral context including side effects (writes to disk, creates parent directories, overwrites files) and return value variations (JSON string vs summary object based on output_path). Could mention error handling or permissions for a 5.

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?

Logically structured with zero waste: purpose statement, structural details, use case, side effects, return values, when-to-use guidance, and alternatives. Each sentence earns its place despite the length, with clear transitions between concepts.

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 completeness for a conversion tool with no output schema: fully documents return value structures for both paths (direct return vs file write), explains disk side effects, and differentiates from extensive sibling tool set. No gaps given the complexity.

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

Parameters3/5

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

Schema coverage is 100% with detailed descriptions for all 3 parameters (markdown, title, output_path). The description references parameters behaviorally ('when output_path is provided') but does not add semantic constraints, formats, or validation rules beyond what the schema already documents. Baseline 3 appropriate given high schema coverage.

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 explicitly states 'Convert Markdown to a structured JSON representation' with specific details about the output structure (document title as root key, arrays of section objects containing headings, paragraphs, lists, etc.). It clearly distinguishes this from siblings by specifying JSON/AST-like output versus tabular or XML formats.

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 guidance ('Use this when you need a machine-readable AST-like representation') and names specific alternatives ('Prefer convert_to_xml for XML-based interchange, or convert_to_csv/convert_to_xlsx for tabular data extraction'), giving clear guidance among the 20+ conversion siblings.

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