Skip to main content
Glama

Crop image

crop_image

Crop a local image to a specified pixel region and save the result to an output path. Use zero-based coordinates applied after EXIF auto-orientation.

Instructions

Crop a local image to a pixel region and save the result. Coordinates are zero-based and apply after EXIF auto-orientation. Returns the source and output paths plus metadata.

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": {
      "image": "<image>",
      "left": "<left>",
      "top": "<top>",
      "width": "<width>",
      "height": "<height>"
    },
    "name": "crop_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
topYesZero-based y offset of the crop region.
leftYesZero-based x offset of the crop region.
imageYesAbsolute path to a local image on the machine running this MCP server.
widthYesCrop width in pixels.
heightYesCrop height in pixels.
qualityNoEncoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output.
losslessNoUse lossless encoding where supported (WebP and AVIF).
file_nameNoOptional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten.
backgroundNoCSS color used as the background, for example #ffffff or transparent.
output_dirNoAbsolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically.
output_formatNoOutput image format. PNG, JPEG, WebP, AVIF, TIFF and GIF are supported.
compression_levelNoPNG compression level (0-9); higher is smaller and slower.

Output Schema

NameRequiredDescriptionDefault
imageYes
sourceYes
detailsNo
operationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare a non-destructive, non-open-world write, so the description only needs incremental context, and it delivers: the coordinate frame is stated as zero-based and applied after EXIF auto-orientation, which materially affects where the crop lands. It also discloses the return shape (source and output paths plus metadata). It does not itself mention the never-overwrite policy or output directory creation, but those are covered in the schema, not contradicted.

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?

Three short sentences, zero waste, with the primary action front-loaded and the coordinate-frame caveat immediately after it. Everything stated is load-bearing for correct invocation.

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?

With 12 parameters all documented in the schema and an output schema present, the description does not need to restate formats, quality, or return fields, and it correctly avoids doing so. The only remaining omission is any mention of overwrite/derived-file behavior at the description level, but the schema covers it, so the definition is effectively complete.

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 the baseline is 3; the description earns an extra point by clarifying that coordinates are zero-based and are interpreted after EXIF auto-orientation. That is meaning not present in the schema's parameter descriptions and directly prevents an off-by-rotation crop error.

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?

The description gives a specific verb and resource ('Crop a local image to a pixel region and save the result'), which clearly separates it from a generate or convert operation. The only gap is that it never mentions or contrasts with near siblings such as resize_image or rotate_image, so an agent must infer the boundary itself.

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?

Usage is implied rather than stated: 'local image' implicitly excludes remote URLs or generated buffers, and cropping is a recognizable operation. There is no explicit when-to-use, when-not-to-use, or pointer to an alternative sibling when a different geometric operation is needed, so the guidance stays at the minimum viable level.

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