Skip to main content
Glama

convert-contents

Converts content between document formats like markdown, HTML, PDF, and DOCX. Specify input and output formats to transform text or files.

Instructions

Converts content between different formats. Transforms input content from any supported format into the specified output format.

🚨 CRITICAL REQUIREMENTS - PLEASE READ:

  1. PDF Conversion:

    • You MUST install TeX Live BEFORE attempting PDF conversion:

    • Ubuntu/Debian: sudo apt-get install texlive-xetex

    • macOS: brew install texlive

    • Windows: Install MiKTeX or TeX Live from https://miktex.org/ or https://tug.org/texlive/

    • PDF conversion will FAIL without this installation

  2. File Paths - EXPLICIT REQUIREMENTS:

    • When asked to save or convert to a file, you MUST provide:

      • Complete directory path

      • Filename

      • File extension

    • Example request: 'Write a story and save as PDF'

    • You MUST specify: '/path/to/story.pdf' or 'C:\Documents\story.pdf'

    • The tool will NOT automatically generate filenames or extensions

  3. File Location After Conversion:

    • After successful conversion, the tool will display the exact path where the file is saved

    • Look for message: 'Content successfully converted and saved to: [file_path]'

    • You can find your converted file at the specified location

    • If no path is specified, files may be saved in system temp directory (/tmp/ on Unix systems)

    • For better control, always provide explicit output file paths

Supported formats:- Basic: txt, html, markdown, ipynb, odt- Advanced (REQUIRE complete file paths): pdf, docx, rst, latex, epub✅ CORRECT Usage Examples:

  1. 'Convert this text to HTML' (basic conversion)

    • Tool will show converted content

  2. 'Save this text as PDF at /documents/story.pdf'

    • Correct: specifies path + filename + extension

    • Tool will show: 'Content successfully converted and saved to: /documents/story.pdf'

❌ INCORRECT Usage Examples:

  1. 'Save this as PDF in /documents/'

    • Missing filename and extension

  2. 'Convert to PDF'

    • Missing complete file path

When requesting conversion, ALWAYS specify:

  1. The content or input file

  2. The desired output format

  3. For advanced formats: complete output path + filename + extension Example: 'Convert this markdown to PDF and save as /path/to/output.pdf'

🎨 DOCX STYLING (NEW FEATURE): 4. Custom DOCX Styling with Reference Documents:

  • Use reference_doc parameter to apply professional styling to DOCX output

  • Create custom templates with your branding, fonts, and formatting

  • Perfect for corporate reports, academic papers, and professional documents

  • Example: 'Convert this report to DOCX using /templates/corporate-style.docx as reference and save as /reports/Q4-report.docx'

🎯 PANDOC FILTERS (NEW FEATURE): 5. Pandoc Filter Support:

  • Use filters parameter to apply custom Pandoc filters during conversion

  • Filters are Python scripts that modify document content during processing

  • Perfect for Mermaid diagram conversion, custom styling, and content transformation

  • Example: 'Convert this markdown with mermaid diagrams to DOCX using filters=["./filters/mermaid-to-png-vibrant.py"] and save as /reports/diagram-report.docx'

📋 Creating Reference Documents:

  • Generate template: pandoc -o template.docx --print-default-data-file reference.docx

  • Customize in Word/LibreOffice: fonts, colors, headers, margins

  • Use for consistent branding across all documents

📋 Filter Requirements:

  • Filters must be executable Python scripts

  • Use absolute paths or paths relative to current working directory

  • Filters are applied in the order specified

  • Common filters: mermaid conversion, color processing, table formatting

📄 Defaults File Support (NEW FEATURE): 7. Pandoc Defaults File Support:

  • Use defaults_file parameter to specify a YAML configuration file

  • Similar to using pandoc -d option in the command line

  • Allows setting multiple options in a single file

  • Options in the defaults file can include filters, reference-doc, and other Pandoc options

  • Example: 'Convert this markdown to DOCX using defaults_file="/path/to/defaults.yaml" and save as /reports/report.docx'

Note: After conversion, always check the success message for the exact file location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentsNoThe content to be converted (required if input_file not provided)
input_fileNoComplete path to input file including filename and extension (e.g., '/path/to/input.md')
input_formatNoSource format of the content (defaults to markdown)markdown
output_formatNoDesired output format (defaults to markdown)markdown
output_fileNoComplete path where to save the output including filename and extension (required for pdf, docx, rst, latex, epub formats)
reference_docNoPath to a reference document to use for styling (supported for docx output format)
filtersNoList of Pandoc filter paths to apply during conversion. Filters are applied in the order specified.
defaults_fileNoPath to a Pandoc defaults file (YAML) containing conversion options. Similar to using pandoc -d option.
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It discloses important behaviors: PDF installation prerequisites, file path requirements, where files are saved (system temp vs. explicit path), success message format, and that output_file is required for advanced formats.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with core purpose and critical requirements, but it is verbose with repeated examples and extensive emoji-heavy formatting. It could be more concise while retaining essential information.

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?

Given the tool's complexity (8 parameters, no output schema), the description covers all necessary aspects: prerequisites, parameter usage, conversion process, post-conversion file location, and advanced features. It is fully adequate for an agent to use the tool correctly.

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

Parameters5/5

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

With 100% schema description coverage, the baseline is 3, but the description adds substantial value: it explains critical file path requirements, gives usage examples, clarifies default behavior, and provides detailed context for reference_doc, filters, and defaults_file parameters beyond the schema.

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 clearly states the tool converts content between formats, listing specific verbs ('Converts', 'Transforms') and resources (content), and enumerates supported formats. With no sibling tools, differentiation is not needed.

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?

The description provides explicit when-to-use guidance with critical requirements (PDF installation, file paths), correct/incorrect examples, and explanations for advanced features like reference_doc, filters, and defaults_file. It clearly distinguishes when detailed output paths are needed.

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/vivekVells/mcp-pandoc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server