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 resize to a target width to reduce file size for shipping assets.

Instructions

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).
Behavior4/5

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

The annotation 'readOnlyHint=true' is consistent with fetching and re-encoding without modifying the source. 'openWorldHint=true' aligns with fetching from a public URL. The description adds value beyond annotations by specifying the return of before/after sizes and the network access, providing helpful behavioral context.

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 extremely concise, using two sentences to convey purpose, output, and usage guidance. Every sentence adds value without redundancy.

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?

Given the absence of an output schema, the description adequately explains the return value ('optimized image plus before/after byte sizes'). It covers the core functionality well, though it could briefly specify the return format (e.g., if it includes a URL or base64 data).

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 adds minimal extra meaning—only mentioning 'public URL' for 'image_url' and 'resizing to target width' for 'width'. The 'format' and 'quality' parameters are not elaborated beyond the schema, so no additional value is provided.

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 verb ('fetch', 're-encode', 'resize'), the resource ('image from a public URL'), and the output ('optimized image plus before/after byte sizes'). It effectively distinguishes the tool from siblings like 'image_format_savings' by focusing on optimization rather than comparison.

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 explicit usage context: 'Use this when an AI-generated or dropped-in asset... is too large to ship.' However, it does not mention when not to use it or reference alternatives, such as 'image_format_savings' for format selection without re-encoding.

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/cleanor-app/cleanor-mcp'

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