Skip to main content
Glama

Compress image

compress_image

Compress PNG, JPEG, WebP, or AVIF images via Tinify.dev, writing a smaller file next to the original or to a specified output path. It never returns larger files, and clearly states when optimization is not possible.

Instructions

Compress a PNG, JPEG, WebP, or AVIF image with Tinify.dev and write the smaller file next to the original (or to output_path). The API never returns more bytes than it received; when it cannot shrink the file the tool says so honestly (optimized: false) instead of pretending.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the image (png, jpg, jpeg, webp, avif; max 40 MB).
overwriteNoAllow replacing an existing file at the output path. Default false.
output_pathNoAbsolute path to write the result. Default: <name>.min.<ext> next to the input. The source image is never overwritten unless output_path points at it AND overwrite is true.
quality_modeNobalanced (default), best_quality, or lossless. lossless is rejected for JPEG inputs.
target_size_kbNoAim for a result at or below this many kilobytes (beta; server rollout).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYes
wroteYesWhether a file was written.
heightYes
optimizedYesfalse when the API could not shrink the file and returned the original bytes; null when the concept does not apply (resize/crop).
request_idYesQuote this when contacting support.
output_pathYesWhere the result was written, or null when nothing was written.
saved_bytesYesoriginal_bytes - result_bytes.
result_bytesYesResult size in bytes.
change_percentYesByte change in percent; negative means smaller.
original_bytesYesInput size in bytes.
Behavior4/5

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

The description adds context beyond annotations: it explains that the API never returns more bytes, honestly reports if it cannot shrink (optimized: false), and clarifies that the source image is never overwritten unless output_path points at it and overwrite is true. No contradiction with annotations (readOnlyHint=false, destructiveHint=false is consistent with writing a new file).

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, front-loaded with the main action and key formats. Every sentence provides essential information with no wasted words.

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?

Given the presence of an output schema (not shown but mentioned), the description covers the core behaviors: input formats, output behavior, and honesty flag. It is complete for a compression tool, including edge cases like inability to shrink.

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 baseline is 3. The description adds value by explaining the default output path naming ('<name>.min.<ext>') and the key behavior of the API (honest failure reporting), which reinforces parameter constraints without repeating schema details.

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 compresses PNG, JPEG, WebP, or AVIF images using Tinify.dev and writes the smaller file. The verb 'compress' and explicit format list make the purpose unambiguous, and it is distinct from siblings like resize, crop, or convert.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives. Usage is implied (when you need to reduce file size), but no exclusion criteria or comparison to siblings like resize_image is provided.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Stianlars1/tinify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server