Skip to main content
Glama

Render HTML to image

html_to_image

Render an HTML string or HTTP(S) URL with headless Chromium and save a screenshot, with viewport sizing, full-page capture, CSS selectors, and multiple image formats.

Instructions

Render an HTML string or HTTP(S) URL with headless Chromium and save a screenshot. Supports viewport size, full-page capture, element selectors, device scale factor and multiple output formats. Requires a local Chrome/Chromium (auto-detected or IMG_CHROME_PATH).

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_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoHTTP(S) page URL to screenshot. Mutually exclusive with html.
htmlNoHTML document or fragment to render. Mutually exclusive with url.
widthNoViewport width in CSS pixels. Defaults to 1280.
heightNoViewport height in CSS pixels. Defaults to 800.
qualityNoEncoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output.
wait_msNoExtra delay before capture, in milliseconds.
base_urlNoBase URL used to resolve relative resources in an HTML string.
losslessNoUse lossless encoding where supported (WebP and AVIF).
selectorNoOptional CSS selector. When provided, only the first matching element is captured.
file_nameNoOptional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten.
full_pageNoCapture the full scrollable page instead of the viewport.
backgroundNoPage background color applied before capture, for example #ffffff. By default the page's own background is kept; JPEG output is flattened onto white unless specified.
output_dirNoAbsolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically.
timeout_msNoNavigation and selector timeout in milliseconds.
wait_untilNoNavigation readiness state. Defaults to load.load
output_formatNoOutput format. Defaults to PNG.png
compression_levelNoPNG compression level (0-9); higher is smaller and slower.
device_scale_factorNoDevice pixel ratio; 2 renders at twice the pixel dimensions.

Output Schema

NameRequiredDescriptionDefault
imageYes
detailsNo
operationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare openWorldHint=true, readOnlyHint=false, destructiveHint=false and idempotentHint=false, so the safety profile is covered. The description adds genuinely new behavioral context: it launches headless Chromium and has an external runtime dependency on a local browser binary with a specific env-var override. It does not restate the file-writing or non-overwrite behavior, but that is already documented per-parameter in the schema.

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?

Three sentences, front-loaded with the core action, then capabilities, then the prerequisite — nothing is wasted. The capability enumeration in sentence two is slightly redundant with the schema, which keeps it from being maximally tight.

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?

With an output schema present, return values need no explanation, and 100% schema coverage handles all 18 parameters. The one thing an agent could still want — the environment prerequisite — is present. Minor residual gap: it doesn't hint that output files land on disk at a configurable directory, which matters for an agent that must report a path.

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 all 18 parameters (including mutual exclusivity of url/html, wait_until enum values, and non-overwrite file naming) are already fully documented. The description's capability list (viewport size, full-page capture, element selectors, device scale factor, output formats) mirrors the schema without adding syntax or defaults beyond it. Baseline 3 applies when the schema does the heavy lifting.

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?

"Render an HTML string or HTTP(S) URL with headless Chromium and save a screenshot" names a specific verb, the two accepted inputs, the rendering engine, and the output artifact. That is clearly distinguishable from every sibling (compress/convert/crop/resize/edit/generate), which all operate on existing images rather than rendering markup.

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?

Usage context is implied by the purpose statement, and the description does give one real precondition: a local Chrome/Chromium must exist, auto-detected or via IMG_CHROME_PATH. It never says when to prefer this over a sibling or what to do when no browser is installed, so guidance is implied rather than explicit.

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