Skip to main content
Glama

Crop image

crop_image

Crop PNG, JPEG, WebP, or AVIF images to a specific rectangle using coordinates, and save the output without altering the original file.

Instructions

Crop a PNG, JPEG, WebP, or AVIF image with Tinify.dev to the given rectangle and write the result next to the original (or to output_path). The source image is never overwritten silently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesLeft edge of the crop rectangle in pixels.
yYesTop edge of the crop rectangle in pixels.
pathYesAbsolute path to the image (png, jpg, jpeg, webp, avif; max 40 MB).
widthYesCrop width in pixels.
heightYesCrop height in pixels.
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.

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 value beyond annotations by stating 'The source image is never overwritten silently', clarifying the non-destructive default behavior. Annotations show destructiveHint=false, so there is no contradiction. The description also mentions the max file size from schema, providing context.

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?

The description is only two sentences, no unnecessary words, and front-loaded with the verb and resource. Every sentence earns its place.

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?

The description covers purpose, input formats, output location, and overwrite safety. Given that an output schema exists (though not shown), the description does not need to explain return values. It is complete enough for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description does not add extra meaning to parameters beyond what the schema provides. It mentions 'to the given rectangle' but does not elaborate on x, y, width, height specifics.

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 verb 'crop', the resource 'image', and specifies supported formats (PNG, JPEG, WebP, AVIF). It also explains the output behavior (writes next to original or to output_path). This clearly distinguishes from sibling tools like compress, resize, and 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 like resize_image or convert_image. It implies cropping by providing a rectangle, but lacks exclusionary guidance or comparison to siblings.

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