Skip to main content
Glama

Compress an image

image_compress

Reduce image file size by setting quality level or finding optimal quality to fit a target size. Reports the exact savings achieved.

Instructions

Reduce an image's file size, either by a quality level or by searching for the best quality that stays under a target size. Reports the exact saving achieved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNohttp(s) URL to fetch. Disabled unless PICTOR_ALLOW_NET_FETCH=true.
pathNoPath to the image, relative to an allowed input root (or absolute inside one).
effortNoEncoder effort; higher is slower and smaller.
qualityNoLossy quality 1-100 (higher is better quality and larger).
losslessNoPrefer lossless compression where supported.
base64_dataNoInline image bytes as base64, optionally a data: URI.
output_nameNoOverride the output filename (a safe name is derived if omitted).
return_imageNoEmbed the resulting image inline so vision-capable clients can see it.
return_base64NoInclude the base64 payload in the JSON result for clients without file access.
target_formatNoOutput codec: jpeg, png, webp, avif, tiff, gif, bmp, ico, jpeg2000, qoi, ppm. Defaults to the input format.
strip_metadataNoRemove EXIF/GPS/ICC metadata. Defaults to the server setting (on).
target_size_kbNoTarget maximum file size in kilobytes; quality is searched to fit.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okNo
inputNoSummary of the source image, when one was read.
notesNo
stepsNo
metricsNoOperation-specific measurements (e.g. comparison scores).
outputsNo
operationYesTool that produced this result.
sizeChangeNo
inlineImageIncludedNoTrue when an image block accompanies this result for vision-capable clients.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the core action and outcome (file size reduction, saving report) but does not mention whether it is destructive, whether it overwrites inputs, or what happens to the original file. It also omits details about input sources (URL/path/base64) beyond what the schema already covers.

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?

Two sentences with zero filler, front-loaded with the primary action and then the two modes. The saving report is mentioned clearly. Efficient and well-structured.

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?

The description covers the core behavior but lacks usage differentiation and side-effect disclosure. Given the tool's complexity (12 parameters) and no annotations, an agent might not know when to use this over image_optimize_web or whether it mutates the source. However, the output schema presumably covers return format, so that gap is filled.

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 all parameters are documented. The description adds valuable meaning by clarifying the relationship between quality and target_size_kb: that quality is searched to fit a target size. This goes beyond the individual parameter descriptions and aids correct invocation.

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 reduces file size with two specific modes (quality level or target-size search) and reports the saving achieved. This is specific and distinguishes it from siblings like image_resize (which changes dimensions) and image_convert (which changes format).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains the two operating modes but gives no guidance on when to choose this tool over alternatives such as image_optimize_web, which likely overlaps in compression functionality. No exclusions or conditions are mentioned, leaving the agent to infer use cases.

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