MCP Tools Reference
The MCP server exposes two tools. Both render in real Chrome, both cost 1 credit per successful image, and both return a full-resolution CDN URL plus a downscaled preview image so the model can review the result.
The parameters mirror the REST API parameters, with two differences: there is no webhook_url (MCP calls are synchronous), and an extra format argument lets the model choose png or pdf.
generate-image-from-html
Renders HTML and CSS to a PNG or PDF. Best for content the model designs itself: social cards, OG images, invoices, certificates, receipts, charts and more.
| Parameter | Type | Required | Description |
|---|---|---|---|
html | string | Yes | Complete, self-contained HTML to render. Put CSS in an inline <style> block. |
css | string | No | Extra CSS injected into the page. |
width | integer | No | Viewport width in pixels (1-5000). |
height | integer | No | Viewport height in pixels (1-5000). |
fullpage | boolean | No | Capture the full scrollable height instead of the viewport. |
dpi | integer | No | Device pixel ratio (1-4) for higher-resolution output. |
ms_delay | integer | No | Milliseconds to wait before capture (e.g. to let fonts or animation settle). |
wait_for_selector | string | No | Wait until this CSS selector appears before capturing. |
format | string | No | png (default) or pdf. |
screenshot-url
Captures a screenshot of a live, publicly accessible web page.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The fully-qualified URL to capture (https://...). |
css | string | No | CSS injected into the page before capture (e.g. to hide cookie banners). |
width | integer | No | Viewport width in pixels (1-5000). |
height | integer | No | Viewport height in pixels (1-5000). |
fullpage | boolean | No | Capture the full scrollable height instead of the viewport. |
selector | string | No | Capture only the element matching this CSS selector. |
dpi | integer | No | Device pixel ratio (1-4). |
ms_delay | integer | No | Milliseconds to wait before capture. |
wait_for_selector | string | No | Wait until this CSS selector appears before capturing. |
Output
On success, a tool returns two things to the model:
- A text part with the full-resolution image URL on the
i.html2img.comCDN and your remaining credit balance. - An image part - a downscaled preview of the render, so the model can see what it produced and iterate. PDFs return the URL only.
The full-resolution file always lives at the returned URL. The inline preview is intentionally small so it fits inside the message-size limits of MCP clients.
The image URL is permanent for the lifetime of a paid account, so the model can hand it straight back to you, drop it into a document, or post it onward.
Credits and errors
- Each successful image costs 1 credit, exactly like the REST API.
- If you are out of credits, the tool returns a clear message instead of an image, and no credit is spent. Top up on the pricing page.
- Render failures (timeouts, unreachable pages, invalid input) come back as readable tool errors so the assistant can adjust and try again.
Reminder: inline your images
The renderer does not fetch remote images. Replace any <img src="https://..."> with a base64 data URI (data:image/png;base64,...). Self-contained HTML with an inline <style> block renders most reliably.
See also
- Install and setup for your AI client.
- Parameters reference for the shared rendering options in depth.