Skip to main content
Glama

convert-contents

Converts Markdown content or files into PowerPoint presentations with optional custom templates.

Instructions

Converts Markdown content to PowerPoint (PPTX) format.

🚨 REQUIREMENTS:

  1. Input: Only Markdown format is supported

  2. Output: Only PPTX format is supported

  3. File Path: Complete output path with filename and .pptx extension is required

✅ Usage Example: 'Convert this markdown to PowerPoint and save as /presentations/demo.pptx'

🎨 PPTX STYLING:

  • Use template parameter to apply custom PowerPoint templates

  • Create templates with your branding, fonts, and slide layouts

  • Example: 'Convert markdown to PPTX using /templates/theme.pptx as template and save as /presentations/pitch.pptx'

➡️ Diagram Support:

  • Diagram using mermaid, plantuml, graphviz is supported by default. Referencing external resource in plantuml is also supported.

  • Example:

@startuml Two Modes - Technical View
' Uncomment the line below for "dark mode" styling
'!$AWS_DARK = true

!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v20.0/dist
!include AWSPuml/AWSCommon.puml

!include AWSPuml/AWSSimplified.puml
!include AWSPuml/General/Users.puml
!include AWSPuml/NetworkingContentDelivery/APIGateway.puml
!include AWSPuml/SecurityIdentityCompliance/Cognito.puml
!include AWSPuml/Compute/Lambda.puml
!include AWSPuml/Database/DynamoDB.puml

left to right direction

Users(sources, "Events", "millions of users")
APIGateway(votingAPI, "Voting API", "user votes")
Cognito(userAuth, "User Authentication", "jwt to submit votes")
Lambda(generateToken, "User Credentials", "return jwt")
Lambda(recordVote, "Record Vote", "enter or update vote per user")
DynamoDB(voteDb, "Vote Database", "one entry per user")

sources --> userAuth
sources --> votingAPI
userAuth <--> generateToken
votingAPI --> recordVote
recordVote --> voteDb
@enduml

📋 Creating Reference Documents:

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

  • Customize in PowerPoint: fonts, colors, slide layouts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentsNoMarkdown content to be converted (required if input_file not provided)
input_fileNoComplete path to Markdown input file (e.g., '/path/to/input.md')
output_fileNoComplete path where to save the PPTX output including filename and .pptx extension (required)
templateNoPath to a template PPTX document to use for styling

Implementation Reference

  • The handle_call_tool function is the handler for the 'convert-contents' tool. It extracts arguments (contents, input_file, output_file, template), validates them, optionally applies a diagram filter and template, then uses pypandoc to convert markdown content/file to PPTX format.
    @server.call_tool()
    async def handle_call_tool(
        name: str, arguments: dict | None
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:    
        """
        Handle tool execution requests.
        Tools can modify server state and notify clients of changes.
        """
        if name not in ["convert-contents"]:
            raise ValueError(f"Unknown tool: {name}")
        
        if not arguments:
            raise ValueError("Missing arguments")
    
        # Extract arguments
        contents = arguments.get("contents")
        input_file = arguments.get("input_file")
        output_file = arguments.get("output_file")
        template = arguments.get("template")
        
        # Validate input parameters
        if not contents and not input_file:
            raise ValueError("Either 'contents' or 'input_file' must be provided")
        
        if not output_file:
            raise ValueError("output_file path is required")
        
        # Validate template if provided
        if template and not os.path.exists(template):
            raise ValueError(f"Template document not found: {template}")
        
        try:
            # Create output directory if it doesn't exist
            output_path = Path(output_file)
            output_path.parent.mkdir(parents=True, exist_ok=True)
            
            # Prepare conversion arguments
            extra_args = []
            
            # Add diagram filter by default
            if DIAGRAM_FILTER_PATH.exists():
                extra_args.extend(["--lua-filter", str(DIAGRAM_FILTER_PATH)])
            
            # Handle template for pptx format
            if template:
                extra_args.extend(["--reference-doc", template])
            
            # Convert content using pypandoc
            if input_file:
                if not os.path.exists(input_file):
                    raise ValueError(f"Input file not found: {input_file}")
                
                pypandoc.convert_file(
                    input_file,
                    "pptx",
                    outputfile=output_file,
                    extra_args=extra_args
                )
            else:
                pypandoc.convert_text(
                    contents,
                    "pptx",
                    format="markdown",
                    outputfile=output_file,
                    extra_args=extra_args
                )
            
            result_message = f"Markdown successfully converted to PPTX and saved to: {output_file}"
            
            return [
                types.TextContent(
                    type="text",
                    text=result_message
                )
            ]
            
        except Exception as e:
            error_msg = f"Error converting markdown to PPTX: {str(e)}"
            raise ValueError(error_msg)
  • The inputSchema for the 'convert-contents' tool defines four properties: contents (markdown string), input_file (path to .md file), output_file (required PPTX output path), and template (optional PPTX template path). Uses oneOf to require either contents+output_file or input_file+output_file.
        inputSchema={
            "type": "object",
            "properties": {
                "contents": {
                    "type": "string",
                    "description": "Markdown content to be converted (required if input_file not provided)"
                },
                "input_file": {
                    "type": "string",
                    "description": "Complete path to Markdown input file (e.g., '/path/to/input.md')"
                },
                "output_file": {
                    "type": "string",
                    "description": "Complete path where to save the PPTX output including filename and .pptx extension (required)"
                },
                "template": {
                    "type": "string",
                    "description": "Path to a template PPTX document to use for styling"
                }
            },
            "oneOf": [
                {"required": ["contents", "output_file"]},
                {"required": ["input_file", "output_file"]}
            ]
        },
    )
  • The 'convert-contents' tool is registered via the handle_list_tools function decorated with @server.list_tools(), returning a types.Tool with name='convert-contents' and its description/inputSchema.
        return [
            types.Tool(
                name="convert-contents",
                description=(
                    "Converts Markdown content to PowerPoint (PPTX) format.\n\n"
                    "🚨 REQUIREMENTS:\n"
                    "1. Input: Only Markdown format is supported\n"
                    "2. Output: Only PPTX format is supported\n"
                    "3. File Path: Complete output path with filename and .pptx extension is required\n\n"
                    "✅ Usage Example:\n"
                    "'Convert this markdown to PowerPoint and save as /presentations/demo.pptx'\n\n"
                    "🎨 PPTX STYLING:\n"
                    "* Use template parameter to apply custom PowerPoint templates\n"
                    "* Create templates with your branding, fonts, and slide layouts\n"
                    "* Example: 'Convert markdown to PPTX using /templates/theme.pptx as template and save as /presentations/pitch.pptx'\n\n"
                    "➡️ Diagram Support:\n"
                    "* Diagram using mermaid, plantuml, graphviz is supported by default. Referencing external resource in plantuml is also supported.\n"
                    """* Example: \n```plantuml
    @startuml Two Modes - Technical View
    ' Uncomment the line below for "dark mode" styling
    '!$AWS_DARK = true
    
    !define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v20.0/dist
    !include AWSPuml/AWSCommon.puml
    
    !include AWSPuml/AWSSimplified.puml
    !include AWSPuml/General/Users.puml
    !include AWSPuml/NetworkingContentDelivery/APIGateway.puml
    !include AWSPuml/SecurityIdentityCompliance/Cognito.puml
    !include AWSPuml/Compute/Lambda.puml
    !include AWSPuml/Database/DynamoDB.puml
    
    left to right direction
    
    Users(sources, "Events", "millions of users")
    APIGateway(votingAPI, "Voting API", "user votes")
    Cognito(userAuth, "User Authentication", "jwt to submit votes")
    Lambda(generateToken, "User Credentials", "return jwt")
    Lambda(recordVote, "Record Vote", "enter or update vote per user")
    DynamoDB(voteDb, "Vote Database", "one entry per user")
    
    sources --> userAuth
    sources --> votingAPI
    userAuth <--> generateToken
    votingAPI --> recordVote
    recordVote --> voteDb
    @enduml
    ```\n\n"""
                    "📋 Creating Reference Documents:\n"
                    "* Generate PPTX template: pandoc -o template.pptx --print-default-data-file reference.pptx\n"
                    "* Customize in PowerPoint: fonts, colors, slide layouts\n"
                ),
                inputSchema={
                    "type": "object",
                    "properties": {
                        "contents": {
                            "type": "string",
                            "description": "Markdown content to be converted (required if input_file not provided)"
                        },
                        "input_file": {
                            "type": "string",
                            "description": "Complete path to Markdown input file (e.g., '/path/to/input.md')"
                        },
                        "output_file": {
                            "type": "string",
                            "description": "Complete path where to save the PPTX output including filename and .pptx extension (required)"
                        },
                        "template": {
                            "type": "string",
                            "description": "Path to a template PPTX document to use for styling"
                        }
                    },
                    "oneOf": [
                        {"required": ["contents", "output_file"]},
                        {"required": ["input_file", "output_file"]}
                    ]
                },
            )
        ]
Behavior4/5

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

With no annotations, the description must carry the burden. It discloses key behaviors: supports only Markdown input and PPTX output, requires complete file paths, supports diagram types (mermaid, plantuml, graphviz), and template usage. No contradictions. It could mention error handling or file size limits, but overall transparent.

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?

The description is moderately long but well-structured using headings, bullet points, and examples. Every section adds value (requirements, examples, diagram support, template creation). The core purpose is front-loaded, and the format is scannable. Could be slightly more concise, but effective.

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 (4 params, no output schema, no siblings), the description covers all necessary aspects: input/output formats, file path requirements, template usage, diagram support, and even how to generate templates. It provides complete guidance for correct invocation.

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?

Input schema has 100% description coverage, so baseline is 3. The description adds significant value beyond schema: explains the oneOf relationship between contents and input_file, provides real usage examples for template, and details diagram support. This extra context justifies a score of 4.

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 'Converts Markdown content to PowerPoint (PPTX) format.' It clearly identifies the input format (Markdown), output format (PPTX), and the tool's action, leaving no ambiguity. With no sibling tools, differentiation is irrelevant, but the description is exceptionally clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit requirements: input must be Markdown, output only PPTX, complete file path required. It includes usage examples and mentions template and diagram support. While it lacks explicit 'when not to use' or alternative tools (none exist), the context is very clear and practical.

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

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