Skip to main content
Glama
beznazwiska

@codetoimage/mcp-server

by beznazwiska

render_html_to_image

Render HTML and CSS into a PNG, JPEG, or WebP image using saved templates with placeholders or raw HTML. Get the image inline for direct display in conversations.

Instructions

Render HTML (and optional CSS) into a PNG/JPEG/WebP image using codetoimage.app. Instead of raw HTML you can pass template_id (a template saved in the dashboard) plus variables to fill its {{placeholders}}, and preset for named platform sizes (og, instagram-story, ...). Returns the image inline so the conversation can display it directly. Use this when you need to see or hand back a finished image (cards, OG previews, charts, badges). If the caller needs a URL to embed elsewhere (Instagram Graph API, OpenGraph meta, Slack unfurl), use render_html_to_url instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cssNoOptional CSS injected as a <style> block.
htmlNoFull HTML (typically including <body>…</body>). Inline styles work; for larger CSS use the `css` field. Required unless `template_id` is provided.
widthNoViewport width in pixels (default 800).
formatNoOutput format. Default: png.
heightNoViewport height in pixels (default 600).
presetNoNamed viewport size: og 1200×630, twitter-card 1200×628, facebook-post 1200×630, linkedin-post 1200×627, instagram-square 1080×1080, instagram-portrait 1080×1350, instagram-story 1080×1920, youtube-thumbnail 1280×720, pinterest-pin 1000×1500. One template, many sizes. Explicit width/height override the preset.
qualityNoEncoder quality (JPEG/WebP only, 1-100).
variablesNoValues for {{placeholders}} in the template (or in `html` if provided). Values are HTML-escaped server-side. Missing placeholders render as empty.
backgroundNoBackground color, e.g. '#ffffff' or 'rgb(10,10,10)'.
template_idNoID of a template saved in the codetoimage dashboard (Templates page). Use INSTEAD of `html` – the saved HTML/CSS renders with {{placeholders}} filled from `variables`.
transparentNoTransparent background (PNG/WebP only; paid plans).
Behavior4/5

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

No annotations provided, so description carries full burden. It explains return format (inline image), mentions paid plans for transparency, and describes placeholder behavior. Lacks details on rate limits or performance, but generally transparent for a rendering tool.

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?

Single dense paragraph, front-loaded with main purpose. Every sentence adds new information without redundancy. Could be slightly more structured (e.g., bullet points), but highly efficient.

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?

Despite no output schema, the description explains what happens with the rendered image. Covers all major features: inline return, template usage, presets, variables, background, transparency (paid). Complete enough for correct tool invocation.

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 coverage is 100%, baseline 3. Description adds value by explaining the two input modes (html vs template_id+variables), preset dimensions, and how variables fill placeholders. Provides more context than schema alone.

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?

Clearly states it renders HTML/CSS to image formats. Describes alternative input modes (template_id with variables) and preset sizes. Explicitly distinguishes from sibling tool render_html_to_url by specifying when to use each.

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

Usage Guidelines5/5

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

Provides explicit guidance: 'Use this when you need to see or hand back a finished image... If the caller needs a URL... use render_html_to_url instead.' Clearly defines context and alternative.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/beznazwiska/codetoimage-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server