Skip to main content
Glama

HTML to PDF

html_to_pdf

Render a URL or a raw HTML string to a PDF in headless Chromium (print-quality, selectable text). Options: paper format (A4, Letter, Legal, A3, A5, Tabloid), landscape, print backgrounds, margins, and scale. Returns a short-lived download URL (valid 1 hour) with byte size, page count and SHA-256; set includeBase64 for the PDF inline (up to 3 MB). Raw HTML up to 2 MB; any external resources it loads go through the same private-address block. Pure rendering, no AI.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "html_to_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoPage to render (provide url OR html)
htmlNoRaw HTML document to render instead of a URL (max 2 MB)
scaleNoRender scale, 0.1-2 (default 1)
formatNoPaper size (default A4)
marginNoCSS margin applied to all sides, e.g. '1cm', '0.5in', '10mm' (default '1cm')
landscapeNoLandscape orientation (default false)
waitUntilNoWhen loading counts as finished (default load)
includeBase64NoAlso return the PDF as base64 in the response (default false; omitted if over 3 MB)
printBackgroundNoInclude CSS backgrounds and colors (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.2/5.0
Behavior5/5

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

Goes well beyond annotations: short-lived URL valid 1 hour, byte size, page count, SHA-256 digest, inline base64 capped at 3 MB, raw HTML capped at 2 MB, and a private-address block applied to externally loaded resources. These are operationally critical facts (expiry, size ceilings, SSRF guard) not derivable from the readOnly/openWorld hints.

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

Conciseness4/5

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

Front-loaded with the core action and input modes, then options, then return contract. Dense but each clause carries information; the parenthetical format enumeration mildly duplicates the schema enum.

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

Completeness5/5

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

No output schema exists, and the description fully compensates by describing the return payload (download URL, lifetime, byte size, page count, SHA-256) plus the inline alternative. Size limits and the network-safety constraint round out what an agent needs before calling.

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 description coverage is 100%, so the schema already documents defaults, ranges and enums for all nine parameters. The description restates the notable ones (format list, landscape, backgrounds, margins, scale, includeBase64) but adds no syntax or behavior beyond what the schema says, so baseline 3 applies.

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?

States a specific verb and dual input resource: 'Render a URL or a raw HTML string to a PDF in headless Chromium.' It also qualifies the output ('print-quality, selectable text'), which distinguishes it from document-extraction siblings like url_to_markdown or structured_data_extract.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clarifies the url-vs-html choice and closes with 'Pure rendering, no AI,' which implies when this is the right tool. However, it never names an alternative or states an explicit when-not-to-use condition, so the agent must infer routing from sibling names alone.

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.