Document Generation
Agents can create documents during conversations using the generate_document MCP tool. This enables agents to produce reports, presentations, spreadsheets, meeting notes, and more -- all formatted as downloadable files.
Supported Formats
| Format | Extension | Library | Best For |
|---|---|---|---|
| PowerPoint | .pptx | PptxGenJS | Presentations, pitch decks, status updates |
| Word | .docx | docx.js | Reports, proposals, meeting notes |
| Excel | .xlsx | ExcelJS | Data exports, financial reports, dashboards |
.pdf | -- | Formal documents (generated from text) | |
| Markdown | .md | -- | Technical docs, READMEs, specs |
| Plain Text | .txt | -- | Logs, raw exports, simple notes |
How It Works
- A user asks an agent to create a document (e.g., "Create a Q4 sales report")
- The agent uses the
generate_documenttool with structured content - MeetLoyd generates the file and stores it as a persistent attachment
- The agent replies with a download link, rendered as an artifact card in chat
User: "Create a presentation about our Q4 results"
Agent thinks: "I should generate a PPTX with the Q4 data"
[Tool Call: generate_document]
format: "pptx"
filename: "Q4-2025-Results.pptx"
content:
title: "Q4 2025 Results"
slides:
- title: "Revenue Overview"
bullets: ["ARR grew 45% YoY", "NRR at 125%", ...]
- title: "Key Wins"
bullets: [...]
Agent: "Here's your Q4 results presentation:"
[Artifact Card: Q4-2025-Results.pptx | PPTX | Download]
Content Structure
PowerPoint (PPTX)
Slides support multiple layouts:
{
format: 'pptx',
filename: 'quarterly-review.pptx',
content: {
title: 'Q4 Quarterly Review',
author: 'Sales Team',
slides: [
{
layout: 'title',
title: 'Q4 2025 Review',
subtitle: 'Sales Department'
},
{
layout: 'content',
title: 'Revenue Highlights',
bullets: [
'ARR grew 45% year-over-year',
'Net Revenue Retention at 125%',
'Average deal size increased 30%'
],
notes: 'Speaker notes for this slide'
},
{
layout: 'two-column',
title: 'Wins & Challenges',
body: 'Left column content | Right column content'
}
]
}
}
Slide layouts: title, content, section, two-column, blank
Word (DOCX)
Documents use a section-based structure:
{
format: 'docx',
filename: 'meeting-notes.docx',
content: {
title: 'Weekly Standup Notes',
author: 'Project Manager Agent',
sections: [
{
heading: 'Attendees',
headingLevel: 2,
bullets: ['Sarah (Engineering)', 'Mike (Product)', 'Lisa (Design)']
},
{
heading: 'Action Items',
headingLevel: 2,
paragraphs: ['The following action items were identified:'],
table: {
headers: ['Owner', 'Task', 'Due Date'],
rows: [
['Sarah', 'Fix auth bug', '2026-02-15'],
['Mike', 'Update roadmap', '2026-02-12']
]
}
}
]
}
}
Section features: Headings (levels 1-4), paragraphs, bullet lists, tables.
Excel (XLSX)
Workbooks contain one or more sheets:
{
format: 'xlsx',
filename: 'sales-report.xlsx',
content: {
title: 'Monthly Sales Report',
sheets: [
{
name: 'Summary',
headers: ['Month', 'Revenue', 'Deals', 'Win Rate'],
rows: [
['January', 125000, 15, '68%'],
['February', 142000, 18, '72%'],
['March', 168000, 22, '75%']
],
columnWidths: [15, 12, 10, 10]
},
{
name: 'Details',
headers: ['Deal', 'Customer', 'Amount', 'Status'],
rows: [
['D-001', 'Acme Corp', 45000, 'Won'],
['D-002', 'Globex', 32000, 'Won']
]
}
]
}
}
Markdown and Plain Text
For simpler formats, use the text field:
{
format: 'md',
filename: 'sprint-retrospective.md',
content: {
title: 'Sprint 42 Retrospective',
text: '# Sprint 42 Retrospective\n\n## What Went Well\n\n- Shipped auth feature on time\n- Zero P1 bugs\n\n## What to Improve\n\n- Code review turnaround time\n- Test coverage for edge cases'
}
}
Artifact Cards
When an agent sends a message containing a file download URL, the chat renders it as a styled artifact card:
- Format-specific icon and color (red for PDF, blue for DOCX, green for XLSX, orange for PPTX)
- File name displayed prominently
- File format label and size
- One-click download
This works for both agent-generated documents and user-uploaded files.
Persistence
Generated documents are stored in the file_attachments database table, tied to the tenant and agent that created them. Files survive server restarts and deployments -- download links remain valid.
Use Cases
| Use Case | Format | Example |
|---|---|---|
| Meeting notes | DOCX | Agent summarizes a team conversation into structured notes |
| Status presentations | PPTX | Weekly status deck auto-generated from project data |
| Data exports | XLSX | Agent pulls CRM data and creates a filtered spreadsheet |
| Compliance reports | Audit report generated from governance pack data | |
| Technical specs | MD | Agent drafts a spec based on conversation requirements |
| Executive summaries | DOCX | Agent distills long thread into one-page brief |
Best Practices
1. Be Specific in Prompts
The more detail you give, the better the document:
✅ "Create a PPTX with 5 slides covering Q4 revenue, key wins,
top customers, challenges, and 2026 outlook"
❌ "Make a presentation about Q4"
2. Let Agents Choose the Format
Include format guidance in agent system prompts:
## Document Generation
When asked to create documents:
- Use PPTX for presentations and visual summaries
- Use DOCX for reports, proposals, and meeting notes
- Use XLSX for data tables and financial reports
- Use MD for technical documentation
- Always include a descriptive filename
3. Combine with File Uploads
Agents can read uploaded files and use them as input for document generation:
User: [Attaches raw-data.csv]
User: "Turn this CSV into a formatted Excel report with charts"
Agent: [Reads CSV] → [Generates formatted XLSX] → [Returns artifact card]
Related: Files & Attachments for upload and file management details.