Skip to main content
Glama

generate-image-from-html

Render HTML and CSS into a PNG image, or into an A4 vector PDF with format "pdf". Provide complete, self-contained HTML and put styles in an inline block. Remote image URLs load if they are real and publicly accessible; embed generated or local images as base64 data URIs rather than inventing URLs. Returns the rendered image plus a shareable CDN URL; PDF renders return the URL only. Consumes one credit per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cssNoOptional additional CSS to inject into the page.
dpiNoScale factor / device pixel ratio (1-4) for higher-resolution output.
htmlYesThe full HTML markup to render. Include CSS in an inline <style> block. Publicly accessible remote image URLs work; use base64 data URIs for images that are not hosted anywhere.
widthNoViewport width in pixels (1-5000). Defaults to 1920.
formatNoOutput format. "png" (default) returns an image sized by width and height. "pdf" returns an A4 portrait vector PDF with selectable, searchable text and automatic pagination; width, height, dpi and fullpage are ignored. Use "pdf" for documents such as invoices, reports, certificates and tickets. Use "png" for social cards, OG images and anything displayed at fixed pixel dimensions.
heightNoViewport height in pixels (1-5000). Defaults to 1080.
fullpageNoCapture the full scrollable page instead of just the viewport.
ms_delayNoMilliseconds to wait before capturing (1-5000), e.g. to let fonts or animations settle.
wait_for_selectorNoWait until this CSS selector is present before capturing.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesShareable CDN URL of the rendered file, at full resolution.
formatYesThe output format that was rendered.
credits_remainingYesCredits left on the plan after this render.

TDQS

A4.4/5.0
Behavior4/5

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

Despite no readOnlyHint/destructiveHint annotations, the description discloses important behavioral traits: credit consumption per call, return values (image + CDN URL for PNG, URL only for PDF), and format-specific parameter ignorance (PDF ignores width/height/dpi/fullpage). This adds context beyond the bare schema.

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?

Five sentences deliver all critical information: purpose, input requirements, image handling, output details, and credit cost. Each sentence earns its place with no redundancy, and the core purpose is front-loaded: 'Render HTML and CSS into a PNG image, or into an A4 vector PDF...'

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 9 parameters, full schema coverage, and an output schema, the description covers usage guidance, behavioral notes, and constraints. It does not address error cases, rate limits, or output schema details (though output schema exists separately). Still adequately complete for a well-documented tool.

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

Parameters4/5

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

Schema description coverage is 100%, and the description adds value by explaining the 'format' parameter's use cases, advising on 'html' content structure (inline CSS, base64 images), and clarifying that 'format: pdf' overrides other sizing parameters. This enhances an already well-described schema.

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 explicitly states the tool renders HTML and CSS into a PNG image or an A4 vector PDF, using specific verbs and resource targets. It clearly distinguishes between the two output formats and their use cases, which differentiates it from the sibling tool 'screenshot-url' (which captures live URLs).

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 provides concrete guidance: complete self-contained HTML with inline styles, handling of images (public URLs vs base64), and explicit recommendations for when to use PNG (social cards, OG images) vs PDF (invoices, reports). It mentions credit consumption. However, it does not directly contrast with the sibling tool or state when to avoid this tool.

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.

TDQS

A4.1/5.0
Disambiguation4/5

Both tools generate visual output, but one renders provided HTML and the other captures a live URL. While both produce images/PDFs, the input method is distinct enough to allow an agent to choose correctly.

Naming Consistency5/5

Both tool names follow a consistent verb_noun pattern: 'generate-image-from-html' and 'screenshot-url'. The naming clearly indicates the action and the input type, making them predictable and easy to understand.

Tool Count5/5

With only two tools, the set is extremely focused for a server dedicated to converting HTML/URLs to images. Each tool serves a clear, non-overlapping purpose, making the count perfectly appropriate for the narrow scope.

Completeness4/5

The tool set covers the two primary use cases: rendering static HTML and capturing live URLs. Missing potential features like batch conversion or custom viewport sizes, but the core functionality for an image generation server is well-covered.

Resources