Skip to main content
Glama

convert_to_xml

Idempotent

Convert Markdown into structured XML documents for data interchange and downstream system integration. Generates well-formed XML with semantic markup including sections, headings, paragraphs, and code blocks.

Instructions

Convert Markdown to an XML document. Parses the Markdown into a structured XML tree with a root element named after the title parameter, containing , , , , , and elements. Produces well-formed XML with an declaration. Side effects: when output_path is provided, writes the XML to disk (creates parent directories, overwrites existing files). When output_path is omitted, returns the XML string directly. Returns: XML string (if no output_path), or JSON { success, file_path, file_size_bytes, format } (if output_path set). Use this for XML-based data interchange or when downstream systems require XML input. Prefer convert_to_json for JSON APIs, convert_to_html for XHTML/web content, or convert_to_csv for flat tabular data.

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. The root XML element name and document title. Must be a valid XML element name (no spaces or special characters). 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.
Behavior5/5

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

Rich disclosure beyond annotations: details exact XML element structure produced (<section>, <heading>, etc.), declares <?xml?> declaration, clarifies dual return behavior (string vs JSON object based on output_path), and explicitly documents side effects including parent directory creation and file overwrite behavior.

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?

Well-structured with logical flow: purpose → technical details → side effects → returns → usage guidance. Front-loaded with core function. Slightly dense but every sentence provides actionable information; no redundant repetition of schema details.

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?

Comprehensive for a dual-mode conversion tool. Despite no output schema, description fully documents both return variants (XML string vs JSON summary object). File system behavior (directory creation, overwrite) is explicitly addressed. Sibling alternatives coverage is complete.

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?

While schema coverage is 100%, description adds crucial contextual usage: explains that 'title' parameter becomes the root XML element name, and clarifies that 'output_path' presence triggers file write mode with JSON metadata return vs direct string return. Enhances agent understanding of parameter interactions.

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?

Excellent specificity: 'Convert Markdown to an XML document' provides clear verb+resource. Critically distinguishes from 20+ sibling conversion tools by naming specific alternatives (convert_to_json, convert_to_html, convert_to_csv) and their use cases.

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?

Explicit when-to-use guidance ('Use this for XML-based data interchange or when downstream systems require XML input') and explicit when-not-to-use with named alternatives. Clear distinction from siblings based on output format requirements.

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