Skip to main content
Glama

image.convert

[paid: $0.0005] Convert an image to PNG, JPEG or WebP, and optionally bound its size, with the Cloudflare Images service: a PNG, JPEG, WebP, GIF or HEIC goes in and the result is stored in this workspace. format is png, jpeg, webp (AVIF is not offered). quality (1-100, default 85) applies to jpeg and webp. width and height (16-4096 px) bound the result and fit picks how: scale-down (the default) shrinks to fit and never enlarges, contain fits inside and may enlarge, cover and crop fill the box and cut the overflow, pad fits inside and fills the rest with background. background (#RRGGBB) fills transparent pixels and padding; a JPEG, which has no transparency, is laid on white unless you name a colour. One call is one Images transformation at $0.0005, charged only when the result is stored; the preview is never charged. Returns JSON {images:[{url, asset_key, download_url?, width, height, content_type}], price, output: {format, bytes, quality?, input_format, input_bytes}, next} plus a preview; a result with no download_url says why in download_url_unavailable. Refuses: SIMPLER_MEDIA_INPUT_MISSING (pass the url or the asset_key), SIMPLER_MEDIA_FOREIGN_KEY (use this workspace's asset_key), SIMPLER_MEDIA_URL_REFUSED (use https, data:image or an asset_key), VALIDATION_ERROR naming the field for a format outside the list, a quality with png, a size outside the range, a fit without width or height, or a background that is not #RRGGBB; SIMPLER_IMAGES_BINDING_ABSENT (this deployment has no Images binding yet, owner step O-2: send a standard PNG), SIMPLER_IMAGES_QUOTA_EXCEEDED or SIMPLER_IMAGES_LEGACY_SUBSCRIPTION (an owner account step: send a standard PNG meanwhile), SIMPLER_IMAGES_INPUT_UNREADABLE (send a PNG, JPEG, WebP, GIF or HEIC), SIMPLER_IMAGES_INPUT_TOO_LARGE (under 20,000,000 bytes and 100 megapixels), SIMPLER_IMAGES_TRANSFORM_FAILED (retry, or send a standard PNG); nothing is charged on any of them; SIMPLER_MEDIA_PIN_TOO_LARGE when the result is over 20MB (pass width and height, or pick jpeg or webp); INSUFFICIENT_CREDITS or PAYMENT_REQUIRED when the workspace cannot cover $0.0005 or is past its spend cap (add credits or raise the cap). NEXT: Pass images[0].asset_key as image_asset_key to image.adjust, image.marketplace_check or another image.* tool; a download_url, when the result carries one, works for 24 hours without a session.

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": {
      "format": "<format>"
    },
    "name": "image.convert"
  }
}

Input Schema

NameRequiredDescriptionDefault
fitNoHow the image fits width and height (default scale-down). Needs width or height.
widthNoBounding width in pixels; leave width and height out to keep the size.
formatYesThe result's file type: png (lossless, keeps transparency), jpeg (smallest for photos, no transparency) or webp.
heightNoBounding height in pixels; leave width and height out to keep the size.
qualityNojpeg and webp only: 1-100, default 85. Refused with png.
image_urlNoThe image to convert: a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP, GIF or HEIC; SVG is refused). Pass this or image_asset_key, not both.
backgroundNo#RRGGBB under transparent pixels and around a padded image. A jpeg defaults to #FFFFFF.
request_refNoOptional idempotency key (1-64 chars: letters, digits, . _ : -). Retrying with the same request_ref and the same arguments within 24 hours returns the first result at $0 with replayed: true; the same request_ref with different arguments is refused (SIMPLER_IMAGE_REQUEST_REF_CONFLICT), and so is a retry whose first result was deleted since (SIMPLER_IMAGE_REQUEST_REF_RESULT_DELETED): send a new request_ref to run it again.
preview_formatNoPreview block after the JSON, at most 384px on the long edge and never charged: png, jpeg or none. Left out, a PNG result gets a png preview and a JPEG or WebP result a jpeg one. A result with no preview says why in preview_unavailable.
image_asset_keyNoThe image to convert, as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY).

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?

The description is exceptionally thorough regarding behavior, disclosing crucial information that annotations miss, such as the exact cost ($0.0005), the 24-hour download URL lifespan, the full list of complex refusal error codes, and charging policies for previews versus stored results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The definition is excessively long and dense. While every section contains valuable information (like error codes or pricing), the sheer volume of text severely detract from its conciseness and requires significant reading effort for the agent.

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?

Given the complexity of the tool (paid, multiple optional constraints, numerous failure modes), the description is maximally complete. It addresses cost, input/output constraints, functional behavior, and detailed error handling, leaving no significant operational detail missing.

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

Parameters5/5

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

Despite the input schema being 100% covered, the description adds vital semantic meaning. For example, it explains the functional differences between the 'fit' enums, specifies that 'quality' applies only to JPEG and WebP, and defines the role of the 'background' parameter in handling transparency.

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 purpose is clearly defined: converting an image to specified formats (PNG, JPEG, WebP) using the Cloudflare Images service. It successfully distinguishes itself from sibling tools by focusing exclusively on format and size transformation rather than general adjustment or generation.

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 strong usage context by detailing supported input formats (PNG, JPEG, WebP, GIF, HEIC) and explicit refusal conditions, which guides the agent on when the tool will fail and what inputs are mandatory versus unsupported.

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