Skip to main content
Glama

image_crop

Read-onlyIdempotent

Crop an image to a region. unit fraction (default): x, y, w, h are 0 to 1 of the image; unit px: pixels. Reads and writes JPEG, PNG, WebP, AVIF, GIF (first frame), TIFF

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": {
      "fileBase64": "<fileBase64>",
      "w": "<w>",
      "h": "<h>"
    },
    "name": "image_crop"
  }
}

Input Schema

NameRequiredDescriptionDefault
hYesHeight of the crop box: 0 to 1 of the height, or pixels with unit px.
wYesWidth of the crop box: 0 to 1 of the width, or pixels with unit px.
xNoLeft edge of the crop box: 0 to 1 of the width (default unit), or pixels with unit px. Default 0.
yNoTop edge of the crop box: 0 to 1 of the height (default unit), or pixels with unit px. Default 0.
unitNofraction (default): x, y, w, h are 0 to 1. px: they are pixels.
formatNopng, jpeg (or jpg), webp, avif, gif, tiff, bmp or ico; image/... types also work. Default: the same format as the input
qualityNo0-1 (for example 0.8) or 1-100 (for example 80); JPEG, WebP, AVIF, and palette PNG
fileBase64YesThe input file as a base64 string, without a data: prefix.
stripMetadataNoRemove EXIF/GPS/colour-profile data. Default true
backgroundColorNoFill for transparent areas (always used for JPEG), e.g. '#ffffff' or 'white'

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / fileBase64 / description
      Added value: +"The input file as a base64 string, without a data: prefix."
    • addedInput schema / properties / h / description
      Added value: +"Height of the crop box: 0 to 1 of the height, or pixels with unit px."
    • addedInput schema / properties / unit / description
      Added value: +"fraction (default): x, y, w, h are 0 to 1. px: they are pixels."
    • addedInput schema / properties / w / description
      Added value: +"Width of the crop box: 0 to 1 of the width, or pixels with unit px."
    • addedInput schema / properties / x / description
      Added value: +"Left edge of the crop box: 0 to 1 of the width (default unit), or pixels with unit px. Default 0."
    • addedInput schema / properties / y / description
      Added value: +"Top edge of the crop box: 0 to 1 of the height (default unit), or pixels with unit px. Default 0."
  2. Changed15 schema fields changed
    • addedInput schema / properties / backgroundColor
      Added value: +{
      +  "description": "Fill for transparent areas (always used for JPEG), e.g. '#ffffff' or 'white'",
      +  "type": "string"
      +}
    • addedInput schema / properties / format / description
      Added value: +"png, jpeg (or jpg), webp, avif, gif, tiff, bmp or ico; image/... types also work. Default: the same format as the input"
    • removedInput schema / properties / format / enum
      Removed value: -[
      -  "image/png",
      -  "image/jpeg"
      -]
    • addedInput schema / properties / h / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / h / maximum
      Removed value: -1
    • removedInput schema / properties / h / minimum
      Removed value: -0
    • addedInput schema / properties / quality
      Added value: +{
      +  "description": "0-1 (for example 0.8) or 1-100 (for example 80); JPEG, WebP, AVIF, and palette PNG",
      +  "maximum": 100,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / stripMetadata
      Added value: +{
      +  "description": "Remove EXIF/GPS/colour-profile data. Default true",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / unit
      Added value: +{
      +  "enum": [
      +    "fraction",
      +    "px"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / w / exclusiveMinimum
      Added value: +0
    • removedInput schema / properties / w / maximum
      Removed value: -1
    • removedInput schema / properties / w / minimum
      Removed value: -0
    • removedInput schema / properties / x / maximum
      Removed value: -1
    • removedInput schema / properties / y / maximum
      Removed value: -1
    • changedInput schema / required
      Previous value: -[
      -  "fileBase64",
      -  "x",
      -  "y",
      -  "w",
      -  "h"
      -]New value: +[
      +  "fileBase64",
      +  "w",
      +  "h"
      +]
  3. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world behavior. The description adds some real context: the accepted input formats and the important GIF caveat ('first frame'). However, it doesn't describe what the tool returns (a base64 image?), how transparency is handled, or the lossy-ness of the operation, which matters for a transform tool.

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?

Three compact clauses, all front-loaded with the core action first and the format constraints last. The telegraphic 'unit fraction (default): x, y, w, h are 0 to 1' style is dense but readable and free of filler.

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?

For a 10-parameter transform tool with no output schema, the description neither explains the return value (likely a base64-encoded cropped image, possibly with format/quality applied) nor notes anything about how format and quality interact with the output. It covers the input formats well but leaves an agent guessing at the result shape.

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 every parameter including unit, format and quality is already documented. The description restates the unit semantics (fraction default vs px) but adds no syntax or constraint detail beyond the schema, so the baseline 3 applies.

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?

States a specific verb+resource ('Crop an image to a region') and the crop-box geometry, which clearly separates it from image_resize and image_rotate by virtue of the region semantics. It doesn't explicitly name the sibling alternative, so it falls just short of 5.

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 by 'crop to a region' and by the unit explanation, but there is no statement of when to prefer this over image_resize or image_convert, and no prerequisites or exclusions. Adequate but inferential.

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