Skip to main content
Glama

Compress an image

compress_image

Make an image file smaller. Keeps the format unless format is given. Set target_bytes to hit an exact file size (e.g. 100000 for 100 KB). Otherwise mode decides: smart (default) finds the smallest file that still looks like the original, quality uses quality (1-100), lossless keeps every pixel (PNG, WebP, AVIF, TIFF only), keep does not compress: the image comes back as it was with only its metadata removed. Reads JPEG, PNG, WebP, AVIF, GIF, TIFF and SVG. Returns a download URL valid for one hour.

Input Schema

NameRequiredDescriptionDefault
modeNoDefault: smart, or quality when `quality` is given.
formatNoOutput format. Default: auto (keep the input format).
rotateNoDegrees clockwise. Not a quarter turn: the corners the turn adds are transparent (or the background colour in JPEG and BMP).
qualityNo
image_urlNoPublic http(s) address of the image. Use this or image_base64.
max_widthNoResize to fit this width; never enlarges.
crop_ratioNoCrop to this shape first, e.g. "1:1" or "16:9", keeping the subject in frame.
max_heightNoResize to fit this height; never enlarges.
image_base64NoThe image file's bytes, base64-encoded. Use for a local file, e.g. one in the repository.
target_bytesNoCompress to at most this many bytes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that `keep` still strips metadata (a real side effect), that lossless is limited to four formats, the accepted input formats, and that the result is a download URL valid for one hour. It does not mention auth requirements, rate limits, or whether the source asset is left untouched, which are the remaining gaps for a mutation-shaped 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?

Front-loads the purpose in one short sentence, then spends the body on the mode decision tree, which is the highest-value information. Dense but nearly every clause carries load; the format list and mode enumeration make it longer than ideal but not padded.

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?

For a 10-parameter tool with no annotations and no output schema, the description covers the return value (hour-limited download URL), the accepted inputs, and the core behavioral branches. It leaves the rotation/crop/resize parameters and any permission model to the schema and outside knowledge, a minor but real gap.

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 already 90%, yet the description adds genuine meaning: target_bytes overrides mode with a concrete example (100000 for 100 KB), the `smart` vs `quality` vs `lossless` vs `keep` semantics, and the format restriction on lossless. Undocumented parameters like `rotate`, `crop_ratio`, and `max_width`/`max_height` are left entirely to the schema, which is acceptable given its richness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ("Make an image file smaller") and immediately qualifies scope by noting format is preserved unless `format` is given. It never names `convert_image` or `upscale_image`, so the agent must infer the boundary between compression, conversion, and upscaling from semantics alone.

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?

Gives clear conditional routing between `target_bytes`, `mode=smart`, `mode=quality`, `mode=lossless`, and `mode=keep`, including the precedence of target_bytes over mode. It stops short of explicit sibling exclusions (e.g. "use convert_image when you only want a different format"), so the agent must reason about overlap with the conversion tool.

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