Skip to main content
Glama

Generate PDF

generate_pdf
Idempotent

Generate a PDF from raw HTML, a public URL, or a template + JSON data. Returns the PDF as base64. Priced per document; retries with the same idempotencyKey never double-generate. The canonical way for an AI agent to turn content into a shareable, correctly-formatted PDF.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesWhat to render. Provide exactly one of: html, url, or (template|templateId) with data.
optionsNoOptional page and print settings.
idempotencyKeyNoA stable key (e.g. an invoice id). Repeat calls with the same key return the stored result instead of re-rendering or re-billing.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
byteSizeNoSize of the PDF in bytes.
pageCountNoNumber of pages in the PDF.
bytesBase64YesThe generated PDF, base64-encoded.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

The description adds behavioral details beyond annotations: pricing, idempotency (reinforcing the idempotentHint), and base64 output format. No contradictions with annotations (readOnlyHint false, idempotentHint true).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. First sentence nails purpose and output. Second sentence covers pricing, idempotency, and positioning. Perfectly front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (3 parameters, nested objects, output schema exists), the description covers key behaviors (input modes, output format, pricing, idempotency). Minor gaps like error handling are compensated by schema and annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal new semantic value beyond summarizing the input sources, which is acceptable but not exceptional.

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 clearly states the verb (generate), resource (PDF), and three distinct input methods (raw HTML, public URL, template+data). It distinguishes from the sibling tool 'read_pdf' which is for reading, not generating.

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 explains pricing per document and idempotency behavior ('retries with the same idempotencyKey never double-generate'). It positions the tool as the canonical way to create a PDF, implicitly guiding when to use it over the read-only sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources