convert_to_xml
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
| Name | Required | Description | Default |
|---|---|---|---|
| markdown | Yes | The 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. | |
| title | No | Optional. 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_path | No | Optional. 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. |