Skip to main content
Glama

Draw HTML as an image

html_to_image

Draw a page of HTML and CSS as a PNG, JPEG or WebP picture: social cards, badges, receipts, mockups, diagrams in SVG. The page is drawn by Chromium with no script and no network access, so inline CSS, SVG and data: pictures and fonts work and anything fetched from an address does not. width and height are the page's size in CSS pixels; scale 2 makes a sharper picture; full_page draws a long page to its end. Returns a download URL valid for one hour.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "html": "<html>"
    },
    "name": "html_to_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
htmlYesThe page: a full HTML document or a fragment, with its CSS in a style element. At most 2 MB.
scaleNoPixels per CSS pixel. Default 1.
widthNoPage width in CSS pixels. Default 1280.
formatNoDefault png.
heightNoPicture height in CSS pixels (the smallest height with full_page). Default 720.
qualityNoFor jpeg and webp. Default 85.
full_pageNoDraw the whole page, up to 16,000 pixels tall.
transparentNoLeave areas the page does not paint see-through (PNG and WebP).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing the rendering environment (Chromium, no script, no network), what consequently does and does not render (inline CSS, SVG, data: pictures and fonts work; remote fetches do not), and the return contract: a download URL valid for one hour. Since no output schema exists, that return-value disclosure is doing real work that nothing else covers.

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?

Four tight sentences, front-loaded with the verb and output formats, then constraints, then the parameter hints, then the return value. No filler and nothing buried at the end that an agent needs first.

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?

Covers the things an agent cannot get from structured fields here: the rendering sandbox limits, the one-hour URL lifetime, and the scale/full_page interactions. With eight parameters and no output schema, this description leaves nothing essential unstated.

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% and the parameter descriptions already state defaults, ranges and units, so the schema carries the load. The description adds only modest interpretation, notably "`scale` 2 makes a sharper picture" and that `full_page` draws a long page to its end; the width/height/scale restatement is largely duplicative.

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 resource: "Draw a page of HTML and CSS as a PNG, JPEG or WebP picture," and enumerates concrete artifact types (social cards, badges, receipts, mockups, diagrams). The no-script/no-network constraint implicitly separates it from the live-URL sibling screenshot_url without needing to open either schema.

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?

Gives a clear usage context and, importantly, an exclusion: anything fetched from an address will not work, which tells the agent when not to pick this tool. It stops short of naming screenshot_url as the alternative for live pages, so the routing decision is left to inference rather than stated.

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