Skip to main content
Glama

compress

Shrink an image file to a target size by finding the highest quality that fits, or apply a quality value or preset. Converts between JPG, WebP, AVIF, and PNG while writing a new file.

Instructions

Make an image file smaller.

target_size='200KB' (or '1.5MB', or bytes): finds the highest quality that still fits, by searching (jpg/webp/avif) and tells you the result. If even min_quality cannot fit, it fails and says what is achievable, unless allow_downscale=true, which then shrinks the pixel dimensions step by step (reported). PNG is lossless: it is re-optimised, and lossy_png=true allows palette reduction (256 -> 16 colors) to reach a target. Without a target: quality=1-100, or preset high (88) / balanced (78) / small (60). format='webp' (or jpg/png) converts while compressing, e.g. a photo PNG to WebP. Output goes to photo.compressed.jpg unless output= is given; never overwrites unless overwrite=true. Warns if the result is not smaller than the input.

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": {
      "path": "<path>"
    },
    "name": "compress"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
formatNo
outputNo
presetNobalanced
previewNo
qualityNo
lossy_pngNo
overwriteNo
allow_hugeNo
min_qualityNo
target_sizeNo
keep_metadataNo
allow_downscaleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/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 largely meets it: it discloses the quality-search strategy across jpg/webp/avif, failure semantics with an achievable-result report, PNG lossless vs lossy_png palette reduction (256 -> 16 colors), default output path, the non-overwrite default, and a warning when the result is not smaller. It omits what preview, allow_huge, and keep_metadata actually do, and does not quantify cost or runtime of the search.

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?

Dense but every clause carries information; there is essentially no filler. The structure is scenario-based, though it front-loads the target_size path even though the schema default is preset='balanced', and the heavy parenthetical nesting makes it harder to scan than a short bulleted breakdown would be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter mutation tool with no annotations and no output schema, the description covers most of the decision space but is silent on preview, allow_huge, and keep_metadata, leaving an agent unable to reason about those flags. It also describes the return only vaguely ("tells you the result"), so what gets reported after a compress is underspecified.

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 description coverage is 0% with 13 parameters, so the description must compensate, and it mostly does: it gives concrete value syntax for target_size ('200KB', '1.5MB', bytes), the numeric mapping of presets (high 88 / balanced 78 / small 60), the quality range, format examples, output naming, and the semantics of lossy_png, min_quality, allow_downscale, and overwrite. Four parameters (preview, allow_huge, keep_metadata, and path beyond being required) receive no explanation.

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+resource ("Make an image file smaller") and then enumerates the three distinct modes: target-size search, explicit quality/preset, and format conversion. It distinguishes itself implicitly from format-only or dimension-only siblings by stating that conversion happens "while compressing", though it never names an alternative tool explicitly.

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 mode-selection guidance: use target_size for a fit-driven search, use quality=1-100 or a named preset when no target is set, and use allow_downscale when min_quality cannot fit. It also states the fallback path ("fails and says what is achievable"). It does not say when to prefer this tool over siblings like convert or resize, which keeps it from a 5.

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