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.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compress_image"
  }
}

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

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

With annotations already covering the safety profile, the description adds real behavior: format is preserved unless overridden, lossless is restricted to PNG/WebP/AVIF/TIFF, keep mode strips metadata, and the return is a one-hour download URL. The metadata removal in keep mode is a subtle side effect not reflected in destructiveHint=false, though it is disclosed in text rather than contradicted.

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 statement is front-loaded and every clause carries information (mode semantics, format restriction, return value). It is a dense single paragraph, making the mode definitions harder to scan than they would be as a short list, but no sentence is filler.

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 a ten-parameter, no-required-parameter tool with no output schema, the description covers the decision logic between parameters, the accepted input formats, the behavioral caveats of each mode, and what is returned (a one-hour download URL). 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 90%, so the schema already documents most parameters; the description still adds the precedence rule that target_bytes overrides mode and that supplying quality implicitly selects quality mode, which is not stated in the schema. Supported input formats and the lossless format restriction are also added.

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?

"Make an image file smaller" names a specific operation on a specific resource, and the mode list makes clear this is a size-reduction tool, not a format converter (convert_image) or enlargement tool (upscale_image). An agent can distinguish it from its siblings without opening the schema.

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 explicit decision rules: use target_bytes for an exact size, otherwise mode decides, with smart/quality/lossless/keep each explained and the default resolution (smart, or quality when quality is given) spelled out. It does not name a sibling to use instead when the goal is format conversion rather than compression, which keeps it short of a 5.

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