create_pdf
Convert a Microsoft Office document (.docx, .xlsx, .pptx) or inline markdown into a PDF, then optionally save the result to OneDrive.
What it does
create_pdf is a single agent tool that dispatches to two pure converters:
- Office formats (
.docx,.xlsx,.pptx,.mdalready in OneDrive) are converted via Microsoft Graph's built-in?format=pdfendpoint. - Inline markdown is rendered with the
md-to-pdfheadless-Chromium pipeline using one of the bundled themes (default,business-case).
The tool can return the PDF inline as base64, write it to OneDrive, or both. Cross-tenant isolation is enforced by construction: the tool always uses the caller's delegated Graph token and the caller's tenant for OneDrive writes; no tenantId parameter is accepted.
When to pick it
Use create_pdf when an agent needs to:
- Produce a PDF from an Office document already stored in OneDrive or SharePoint.
- Render an agent-authored markdown report (status update, business case, daily brief) into a polished, themed PDF that can be attached to email, posted to a project, or saved to OneDrive.
- Convert a small batch of files in-place without exposing the conversion mechanics to the caller.
It is not the right tool for:
- OpenDocument or legacy Office formats (
.odt,.doc,.rtf). - Excel sheet-selection or fit-to-page rendering controls.
- PDF post-processing (watermarks, page numbers, merging documents).
- Inline non-markdown bytes - pass
.docx/.xlsx/.pptxthrough OneDrive (source.graphItem) instead.
Input examples
The source field is a discriminated union: provide exactly one of source.graphItem or source.inline.
Source: graphItem (Office format already in OneDrive)
{
"source": {
"graphItem": {
"driveId": "b!abc...",
"itemId": "01XYZ..."
}
},
"output": "onedrive",
"destination": {
"folderPath": "/Reports/2026-Q1"
}
}
When output is "onedrive" and destination.folderPath / destination.filename are omitted, the PDF is written next to the source item with the same base filename plus .pdf.
Source: inline markdown
{
"source": {
"inline": {
"format": "markdown",
"content": "# Q1 Status\n\nProgress against goals...",
"filename": "q1-status.md"
}
},
"theme": "business-case",
"output": "onedrive",
"destination": {
"folderPath": "/Outermind Artifacts/PDFs"
}
}
theme is honored for inline markdown only; it is ignored on the graphItem path. Themes are CSS files keyed by name (currently default and business-case).
Output: inline (return base64 only, no OneDrive write)
{
"source": {
"inline": {
"format": "markdown",
"content": "# Daily Brief\n\n...",
"filename": "daily-brief.md"
}
},
"output": "inline"
}
The response carries pdfBase64 and no onedrive block.
Output: both (return base64 AND save to OneDrive)
{
"source": {
"graphItem": {
"driveId": "b!abc...",
"itemId": "01XYZ..."
}
},
"output": "both",
"destination": {
"folderPath": "/Reports/2026-Q1",
"filename": "summary.pdf"
}
}
The response carries both pdfBase64 and an onedrive block (driveId, itemId, webUrl).
Output: onedrive (default, save only)
{
"source": {
"graphItem": {
"driveId": "b!abc...",
"itemId": "01XYZ..."
}
}
}
output defaults to "onedrive". The response carries an onedrive block and no pdfBase64.
Error codes the agent can react to
The tool returns a structured error envelope on failure. Each error declares retryable so the agent can decide between immediate retry, escalation, or a different approach.
| Code | Meaning | Retryable |
|---|---|---|
unsupported_format | The graphItem source is not a format Graph can convert (e.g., .txt, .zip). | No |
graph_conversion_failed | Microsoft Graph returned a server error during conversion. One automatic retry has already been attempted. | Yes |
render_failed | The markdown render pipeline failed or timed out. | Yes (re-render may succeed; reduce input size if persistent) |
source_not_found | The graphItem driveId/itemId does not exist or the caller cannot access it (404 or 403). Often a permissions problem rather than a missing file. | No |
input_too_large | Inline markdown exceeded 5 MB, or the source graphItem exceeded 50 MB. | No |
destination_unavailable | The OneDrive write target could not be reached (drive offline, quota exceeded, folder permission denied). | Yes |
Agent guidance for common cases:
source_not_found: surface the failure to the user with a request to verify the file path or share permissions; do not retry blindly.input_too_large: shrink the markdown (trim verbose sections, drop large embedded images) or split the source document; retry once with the smaller input.destination_unavailable: fall back tooutput: "inline"to return the base64 PDF, then ask the user where to save it.
Limits
| Limit | Value | Where enforced |
|---|---|---|
| Inline markdown input size | 5 MB | markdown-pdf converter |
Source file size (graphItem) | 50 MB (pre-checked via Graph metadata) | graph-format-pdf converter |
| Markdown render timeout | 30 seconds | markdown-pdf converter |
| Graph 429 retry | One automatic retry honoring Retry-After | graph-format-pdf converter |
Telemetry: every call emits one structured tool-call log entry with { tool, durationMs, sourceKind, sourceFormat, outputMode, byteSize, ok, errorCode? }.
Default availability
create_pdf ships in the Document Conversion tool group. CAIOO and PA see this group default-on and have the tool available out of the box. Tenant-custom agents see Document Conversion as opt-in; an admin must enable it via the agent's tool assignment panel.
Related tools
save_file_to_onedrive- generic OneDrive write for non-PDF artifacts.link_artifact_to_project- record the resulting PDF on a CAIOO project page.