Skip to main content
Glama

Optimize / convert an image for the web

optimize_image
Read-only

Fetch an image from a public URL and re-encode it smaller (WebP/AVIF/JPEG), optionally resizing to a target width. Returns the optimized image plus before/after byte sizes. Use this when an AI-generated or dropped-in asset (hero image, screenshot, illustration) is too large to ship.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthNoResize to this width in px, preserving aspect ratio. Omit to keep original size.
formatNoOutput format. webp = best browser support; avif = smallest; jpeg = universal.webp
qualityNoEncode quality 1-100 (80 is a good default).
image_urlYesPublic URL of the source image (PNG/JPEG/WebP/AVIF/GIF).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYesOutput image format.
mime_typeYes
saved_pctYesPercent smaller than the original.
original_bytesYes
optimized_bytesYes

TDQS

A4.2/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true and openWorldHint=true, and the description aligns with these, adding context beyond them. It discloses the key behavior: fetching from a public URL, re-encoding to a smaller size, and returning before/after byte sizes. This is useful contextual info beyond the annotations, though it does not reveal potential edge cases like URL accessibility or size limits, which are not required given the openWorldHint and schema coverage.

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?

The description is two sentences long, front-loaded with the main action, and the second sentence justifies usage. Every word earns its place, with no redundant phrases or filler. It is concise, structured, and easy to scan.

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?

The description is complete for a tool with 4 parameters (1 required) and an output schema. It explains the core function, the optional resizing, and the return type (optimized image with before/after sizes). The use case is also stated. Given the output schema exists, it does not need to detail return values further. A minor gap is the lack of mention of potential input constraints (e.g., must be publicly accessible), but the schema's URI format already hints at this, so 4 is fair.

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 the baseline is 3. The description mentions 'optionally resizing to a target width' and lists formats, but these mirror the schema descriptions rather than adding new meaning. No additional parameter semantics beyond the schema are provided, so a 3 is appropriate.

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 description clearly states the tool's function: 'Fetch an image from a public URL and re-encode it smaller (WebP/AVIF/JPEG), optionally resizing to a target width.' This uses a specific verb (fetch and re-encode) with clear resources and output. It distinguishes itself from siblings like placeholder_image (which generates placeholders) and image_format_savings (which likely estimates savings without performing conversion) by focusing on actual conversion/optimization.

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 an explicit use case: 'Use this when an AI-generated or dropped-in asset (hero image, screenshot, illustration) is too large to ship.' This gives clear guidance on when to use the tool. However, it does not explicitly mention when not to use it or name alternative tools like image_format_savings for comparative analysis, so it falls short of a 5.

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.

TDQS

A4.3/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: base64 encoding, color conversion, string counting, hashing, image format comparison, JSON formatting, JWT decoding, image optimization, QR code generation, slugification, storage capacity calculation, and UUID generation. No two tools overlap in functionality.

Naming Consistency4/5

Tool names are mostly consistent using lowercase and underscores, but they mix patterns: some are nouns (color, hash, uuid), some verbs (count, slugify), and some verb_noun pairs (jwt_decode, optimize_image). This minor inconsistency is still readable.

Tool Count5/5

With 12 tools, the count is well within the ideal range. Each tool serves a specific and useful utility function, making the set well-scoped for a general-purpose developer toolkit.

Completeness4/5

The tool set covers a broad range of common web development utilities (encoding, colors, hashing, JSON, images, UUIDs). Minor gaps like URL encoding or HTML escaping are missing, but the core functionalities are well-represented.