> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poesius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Slides (MCP)

> End-to-end slide generation using MCP tools

## Tool: `generate_slides` (Recommended)

End-to-end slide generation from a topic or document. This is the recommended tool for most use cases.

When you call this tool, Poesius automatically performs three steps:

1. **Generates the presentation narrative** - Creates a McKinsey-style story, summarizing key findings and revealing insights from your content
2. **Retrieves layout details** - Gets template specifications including colors, layout zones, and design elements (defined visually in the web app at `https://app.poesius.com`)
3. **Creates slides** - Combines the narrative with template specs to produce professional PPTX files

## Parameters

| Parameter         | Type    | Required | Description                                 |
| ----------------- | ------- | -------- | ------------------------------------------- |
| `topic`           | string  | No       | Topic if generating from scratch            |
| `content`         | string  | No       | Existing markdown content to convert        |
| `instructions`    | string  | Yes      | Generation instructions                     |
| `template_id`     | string  | No       | Template UUID (required if no default)      |
| `num_slides`      | integer | No       | Target number of slides                     |
| `conversation_id` | string  | No       | Existing conversation UUID                  |
| `presentation_id` | string  | No       | Existing presentation UUID to add slides to |
| `document_base64` | string  | No       | Base64-encoded document                     |

## Example Request

### From Topic

```json theme={null}
{
  "method": "tools/call",
  "params": {
    "name": "generate_slides",
    "arguments": {
      "topic": "Introduction to Machine Learning",
      "instructions": "Create a comprehensive presentation covering ML basics, algorithms, and applications",
      "template_id": "123e4567-e89b-12d3-a456-426614174000",
      "num_slides": 20
    }
  }
}
```

### From Document

```json theme={null}
{
  "method": "tools/call",
  "params": {
    "name": "generate_slides",
    "arguments": {
      "instructions": "Create a professional presentation from this document",
      "template_id": "123e4567-e89b-12d3-a456-426614174000",
      "num_slides": 15,
      "document_base64": "<base64_encoded_document>"
    }
  }
}
```

## Response

```json theme={null}
{
  "slides": [
    {
      "slide_id": "uuid",
      "slide_number": 1,
      "layout": "Title Slide",
      "master_name": "Master 1",
      "content": {
        "title": "Introduction to Machine Learning",
        "subtitle": "A Comprehensive Overview"
      },
      "thumbnail_url": "https://...",
      "download_url": "https://...",
      "web_url": "https://..."
    }
  ],
  "content": "Generated markdown content...",
  "presentation_id": "uuid",
  "conversation_id": "uuid",
  "slide_ids": ["uuid1", "uuid2"],
  "total_slides": 20,
  "reflection": "Generated 20 slides covering...",
  "presentation_url": "https://app.poesius.com/presentations/uuid",
  "download_url": "https://poe.poesius.com/api/v1/presentations/uuid/download"
}
```

## Response Fields

* `slides`: Array of slide objects with content and URLs
* `content`: Generated markdown content
* `presentation_id`: ID of the created presentation
* `conversation_id`: ID of the conversation
* `slide_ids`: Array of slide IDs
* `total_slides`: Total number of slides created
* `reflection`: AI reflection on what was generated
* `presentation_url`: Web URL to view the presentation
* `download_url`: Direct download link for PPTX

## Template Required Response

If `template_id` is not provided and there's no default template, you'll receive:

```json theme={null}
{
  "requires_template": true,
  "message": "Please select a template from the list below",
  "available_templates": [
    {
      "template_id": "uuid",
      "template_name": "Professional Blue"
    }
  ],
  "default_template_id": null
}
```

**Solution**: Call `list_templates` first, then provide a `template_id` in your request.

## Python Example

```python theme={null}
import requests
import base64

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

def read_document(file_path):
    with open(file_path, 'rb') as f:
        return base64.b64encode(f.read()).decode('utf-8')

def generate_slides(topic=None, instructions, template_id, num_slides, document_path=None):
    arguments = {
        "instructions": instructions,
        "template_id": template_id,
        "num_slides": num_slides
    }
    
    if topic:
        arguments["topic"] = topic
    
    if document_path:
        arguments["document_base64"] = read_document(document_path)
    
    response = requests.post(
        f"{BASE_URL}/messages",
        headers={
            "X-API-Key": API_KEY,
            "Content-Type": "application/json"
        },
        json={
            "method": "tools/call",
            "params": {
                "name": "generate_slides",
                "arguments": arguments
            }
        }
    )
    return response.json()

# Generate from topic
result = generate_slides(
    topic="Quarterly Business Review",
    instructions="Create a comprehensive presentation with 15 slides",
    template_id="123e4567-e89b-12d3-a456-426614174000",
    num_slides=15
)

print(f"Generated {result['result']['total_slides']} slides")
print(f"Download URL: {result['result']['download_url']}")
```

## Best Practices

* **Use Templates**: Always specify a `template_id` for consistent branding
* **Clear Instructions**: Be specific about what you want in the presentation
* **Slide Count**: Specify a target number based on your needs
* **Document Encoding**: Ensure documents are properly base64-encoded

<Card title="Two-Step Process" icon="diagram-project" href="/mcp/two-step-process">
  Learn about the two-step generation process for more control
</Card>

<Card title="List Templates" icon="list" href="/mcp/list-templates">
  Discover available templates
</Card>

<Card title="Examples" icon="code" href="/examples/mcp-python">
  See more MCP examples
</Card>
