Skip to main content
Glama

Resize image

resize_image

Resize local images to a target width or height using cover, contain, fill, inside, or outside fitting modes, then save the output in your chosen format and quality.

Instructions

Resize a local image with sharp's cover/contain/fill/inside/outside fitting modes and save the result. At least one of width or height is required.

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>"
    },
    "name": "resize_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
fitNoHow the image fits the target box. Defaults to cover. Use contain to letterbox, inside to preserve aspect ratio without cropping, or fill to stretch.
imageYesAbsolute path to a local image on the machine running this MCP server.
widthNoTarget width in pixels. At least one of width/height is required.
heightNoTarget height in pixels. At least one of width/height is required.
kernelNoResampling kernel. Defaults to lanczos3.
qualityNoEncoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output.
losslessNoUse lossless encoding where supported (WebP and AVIF).
positionNoCrop position/gravity when fit is cover or contain.
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.
without_enlargementNoDo not enlarge images that are already smaller than the target.

Output Schema

NameRequiredDescriptionDefault
imageYes
sourceYes
detailsNo
operationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

A3.8/5.0
Behavior3/5

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

Annotations declare a non-read-only, non-destructive, non-idempotent write, and 'save the result' is consistent with that. Useful extra facts (existing files are never overwritten, output directory is auto-created, suffixing on multiple outputs) live only in the schema, so the description adds little behavioral context beyond the annotations.

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?

Two sentences, front-loaded with the action and resource, with zero filler. The list of fitting modes slightly duplicates the schema enum but stays short enough not to be wasteful.

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 an output schema present and full parameter documentation, the description needn't explain return values, and it covers the core operation adequately. The remaining gap is routing context, since a 14-parameter image tool that also encodes output format should clarify its boundary against convert_image and crop_image.

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

Parameters5/5

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

Schema description coverage is 100% with all 14 parameters documented, including enum semantics for fit, kernel, position and output_format. The description reinforces the fit-mode meanings and the width/height requirement, so parameter meaning is fully available without guessing.

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 and resource ('Resize a local image') and names the fitting modes and that the result is saved. This clearly separates it from siblings like crop_image or compress_image, though it doesn't acknowledge the overlap with convert_image despite exposing an output_format parameter.

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 only guidance is a constraint ('At least one of width or height is required'), not when-to-use direction. It never says when to pick this over crop_image (aspect-preserving crop) or convert_image (format change), even though output_format here duplicates a conversion capability.

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