Skip to main content

Error Response

When a template is required but not provided:
{
  "requires_template": true,
  "message": "Please select a template from the list below",
  "available_templates": [
    {
      "template_id": "uuid",
      "template_name": "Professional Blue"
    },
    {
      "template_id": "uuid",
      "template_name": "Modern Red"
    }
  ],
  "default_template_id": null
}

Solution

Step 1: List Templates

First, get the list of available templates:
{
  "method": "tools/call",
  "params": {
    "name": "list_templates",
    "arguments": {}
  }
}

Step 2: Select a Template

Choose a template_id from the response.

Step 3: Retry with Template

Include the template_id in your request:
{
  "method": "tools/call",
  "params": {
    "name": "generate_slides",
    "arguments": {
      "topic": "My Presentation",
      "instructions": "Create slides",
      "template_id": "uuid-from-available-templates"
    }
  }
}

Python Example

import requests

API_KEY = "pk_your_api_key_here"
BASE_URL = "https://poe.poesius.com/api/v1/mcp"

def generate_with_template_handling(topic, instructions, num_slides):
    """Generate slides with automatic template handling"""
    
    # Try without template first
    response = call_mcp_tool("generate_slides", {
        "topic": topic,
        "instructions": instructions,
        "num_slides": num_slides
    })
    
    # Check if template is required
    if response.get("result", {}).get("requires_template"):
        # Get available templates
        templates_response = call_mcp_tool("list_templates", {})
        templates = templates_response["result"]["templates"]
        
        # Use first template (or let user choose)
        template_id = templates[0]["template_id"]
        print(f"Template required. Using: {templates[0]['template_name']}")
        
        # Retry with template
        response = call_mcp_tool("generate_slides", {
            "topic": topic,
            "instructions": instructions,
            "num_slides": num_slides,
            "template_id": template_id
        })
    
    return response

Prevention

Always Provide Template ID

# Get template first
templates = call_mcp_tool("list_templates", {})
template_id = templates["result"]["templates"][0]["template_id"]

# Use in generation
result = call_mcp_tool("generate_slides", {
    "topic": "My Presentation",
    "instructions": "Create slides",
    "template_id": template_id,
    "num_slides": 15
})

Use Default Template

If your account has a default template, you can omit template_id:
# Check for default template
templates = call_mcp_tool("list_templates", {})
default_id = templates["result"].get("default_template_id")

if default_id:
    # Can omit template_id
    result = call_mcp_tool("generate_slides", {
        "topic": "My Presentation",
        "instructions": "Create slides",
        "num_slides": 15
    })
else:
    # Must provide template_id
    template_id = templates["result"]["templates"][0]["template_id"]
    result = call_mcp_tool("generate_slides", {
        "topic": "My Presentation",
        "instructions": "Create slides",
        "template_id": template_id,
        "num_slides": 15
    })

REST API

For REST API, always include template_id:
curl -X POST "https://poe.poesius.com/api/v1/slides/generate-from-doc" \
  -H "X-API-Key: pk_your_api_key" \
  -F "document=@document.pdf" \
  -F "template_id=123e4567-e89b-12d3-a456-426614174000" \
  -F "num_slides=15"

Selecting Templates

Learn how to select templates

List Templates

See how to list templates