Skip to main content
Glama

Optimize image for the web

optimize_image

Resize an image to a max width and encode as WebP to shrink files for web use, preserving transparency. Costs 0.01 USDC per call on Base.

Instructions

Resizes one image so its longest side is at most max_width pixels (never enlarging it) and encodes it as WebP at the given quality. Transparency is kept; metadata is not carried over. Costs 0.01 USDC per call (real money) on Base, paid from the buyer's wallet over x402 after the buyer's spending limits are checked. Input: PNG, JPEG, WEBP, up to 8 MB, at most 8000 px. Give exactly one of image_url or image_path. Output: image/webp, as a download link (and a file with save_to).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qualityNoWebP quality.
save_toNoOptional local file path to save the result to (image/webp).
image_urlNoA public https URL of the image.
max_widthNoLongest side of the output, in pixels.
overwriteNoReplace save_to if it exists. Default false.
image_pathNoA local image file to send (read by this server, sent base64).
allow_repeatNoBuy again even if the same request was bought in the last 10 minutes. Default false: the earlier result is returned and nothing is charged.
max_price_usdcNoOptional: refuse if Bacon asks more than this, in USDC.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, idempotentHint=false, openWorldHint=true), the description discloses the paid x402 flow, that spending limits are checked before charge, the exact price, that metadata is dropped, that transparency is preserved, and that images are never upscaled. These are material behaviors an agent cannot infer from the schema or annotations.

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?

The core operation is front-loaded in the first sentence, followed by cost, constraints, and output. It is dense but every clause carries load; the single run-on paragraph with mixed input/output/cost facts costs it a point on structure.

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?

For an 8-parameter, no-output-schema tool this covers what an agent needs: accepted formats, size and pixel limits, required parameter exclusivity, output MIME type and delivery mode, and the payment model. Nothing essential for correct invocation is missing.

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%, so the baseline is 3, but the description adds meaning the schema does not: the mutual exclusivity constraint 'give exactly one of image_url or image_path', the never-enlarge semantics of max_width, and the download-link/save_to output pairing. It does not clarify quality or max_price_usdc behavior beyond what the schema already says.

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 first sentence states a precise verb, resource and transformation: resize so the longest side is at most max_width (never enlarging) and re-encode as WebP at the given quality. This is clearly distinguishable from siblings like remove_background, brand_from_url, and image_palette, which perform different image operations.

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?

It gives strong context for deciding to call it: real-money cost of 0.01 USDC, accepted input formats and size limits, and the exactly-one-of image_url/image_path rule. It never names an alternative tool or an explicit 'do not use this when' condition, so it stops short of full routing guidance.

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