Skip to main content
Glama

Analyze images (dry run)

analyze_images
Read-only

Preview image optimisation without writing files: reports per-image chosen format, byte savings and measured quality (SSIM or pixel-exact) so you can show expected results before applying changes.

Instructions

Read-only dry run: runs the full optimisation in memory and reports, per image, the format Optiq would choose, bytes before and after, and the measured quality (SSIM, or pixel-exact). Writes nothing. Use it first to show the user the expected savings, then call optimize_images with the same arguments. Main parameters: paths (files or folders), mode (how strict the quality check is), keepFormat/formats (whether and to what the format may change), maxSize (downscale), stripMetadata (drop EXIF/GPS). Cost: it does the same work as optimize_images, several encodes per image, typically 0.3-3 s per image on a modern laptop (fast mode is quicker; very large screenshots in visually-lossless can take tens of seconds). For hundreds of images, try one subfolder first. Progress is reported per file and the call can be cancelled.

Input Schema

NameRequiredDescriptionDefault
modeNoHow strict the quality check is. lossless: decoded pixels verified identical (JPEG inputs only get metadata changes). visually-lossless: SSIM >= 0.99. balanced (default): SSIM >= 0.975. fast: same threshold as balanced, no AVIF, at most 5 encodes, about 3x faster. Use visually-lossless for hero images, artwork and product photos.balanced
pathsYesImage files and/or folders. Folders are searched recursively for jpg, jpeg, png, webp, avif and gif; dot-folders are skipped. Use absolute paths; relative ones resolve against the server's working directory.
formatsNoFormats Optiq may choose when the format may change. Default: all four (fast mode: no avif). Drop avif if the site must support browsers older than Safari 16.4. JPEG is never chosen for images with transparency.
maxSizeNoDownscale so the longest side is at most this many pixels, e.g. 2560 for camera photos on a website. Smaller images are not enlarged. Allowed in lossless mode too (the resize itself changes pixels).
minSavingNoKeep a file unchanged unless it gets at least this share smaller (0.05 = 5%). Default 0.02. Raise it to avoid churning files for tiny gains.
keepFormatNoNever change the file format (a .png stays PNG). Default: true for in-place writes and for analysis, false when writing to outDir. Set false in analysis to see what converting to WebP/AVIF would save.
minQualityNoCustom SSIM threshold for perceptual modes instead of the mode's default, e.g. 0.98. Higher keeps more detail and saves less. Ignored in lossless mode.
stripMetadataNoRemove EXIF (including GPS location, camera serial) and XMP. Recommended before publishing personal photos. Colour profiles that matter (non-sRGB ICC) and image orientation are preserved either way.

Output Schema

NameRequiredDescriptionDefault
filesYes
dryRunYes
totalsYes
omittedFilesYesFiles processed but not listed (the list is capped); totals include them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.1.2
    • changedInput schema / properties / formats / description
      Previous value: -"Formats allowed when the format may change. Default all four. Drop avif if the site must support old browsers."New value: +"Formats Optiq may choose when the format may change. Default: all four (fast mode: no avif). Drop avif if the site must support browsers older than Safari 16.4. JPEG is never chosen for images with transparency."
    • changedInput schema / properties / keepFormat / description
      Previous value: -"Never change the file format. Default: true for in-place writes and analysis, false when writing to outDir."New value: +"Never change the file format (a .png stays PNG). Default: true for in-place writes and for analysis, false when writing to outDir. Set false in analysis to see what converting to WebP/AVIF would save."
    • changedInput schema / properties / maxSize / description
      Previous value: -"Downscale so the longest side is at most this many pixels."New value: +"Downscale so the longest side is at most this many pixels, e.g. 2560 for camera photos on a website. Smaller images are not enlarged. Allowed in lossless mode too (the resize itself changes pixels)."
    • changedInput schema / properties / minQuality / description
      Previous value: -"Custom SSIM threshold for perceptual modes, e.g. 0.98."New value: +"Custom SSIM threshold for perceptual modes instead of the mode's default, e.g. 0.98. Higher keeps more detail and saves less. Ignored in lossless mode."
    • changedInput schema / properties / minSaving / description
      Previous value: -"Keep a file unchanged unless it gets at least this much smaller. Default 0.02."New value: +"Keep a file unchanged unless it gets at least this share smaller (0.05 = 5%). Default 0.02. Raise it to avoid churning files for tiny gains."
    • changedInput schema / properties / mode / description
      Previous value: -"lossless: pixels verified identical. visually-lossless: SSIM >= 0.99. balanced (default): SSIM >= 0.975. fast: like balanced, no AVIF, fewer encodes. Use visually-lossless for hero images, artwork, product photos."New value: +"How strict the quality check is. lossless: decoded pixels verified identical (JPEG inputs only get metadata changes). visually-lossless: SSIM >= 0.99. balanced (default): SSIM >= 0.975. fast: same threshold as balanced, no AVIF, at most 5 encodes, about 3x faster. Use visually-lossless for hero images, artwork and product photos."
    • changedInput schema / properties / paths / description
      Previous value: -"Image files and/or folders (searched recursively, dot-folders skipped). Absolute paths recommended."New value: +"Image files and/or folders. Folders are searched recursively for jpg, jpeg, png, webp, avif and gif; dot-folders are skipped. Use absolute paths; relative ones resolve against the server's working directory."
    • changedInput schema / properties / stripMetadata / description
      Previous value: -"Remove EXIF (including GPS location) and XMP. Recommended before publishing photos."New value: +"Remove EXIF (including GPS location, camera serial) and XMP. Recommended before publishing personal photos. Colour profiles that matter (non-sRGB ICC) and image orientation are preserved either way."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, but the description adds substantial behavioral context beyond them: it writes nothing, performs the same work as optimize_images including several encodes per image, gives expected timing ranges, notes progress reporting and cancellation. No contradictions with annotations.

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 dense but front-loaded: read-only purpose and output are stated first, followed by the optimize_images relationship, parameter summary, cost profile, and scaling advice. Every sentence contributes actionable information.

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?

Although an output schema exists, the description still conveys the essential return shape and operational behavior an agent needs: per-image format, bytes, and quality metrics, plus performance expectations, cancellation, and sibling-tool relationship. It is complete for this tool.

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 the schema already fully documents all eight parameters. The description summarizes several main parameters but mostly repeats schema content and omits minSaving and minQuality, adding only marginal semantic value beyond the structured fields.

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 states a specific verb and resource: a read-only dry run that runs image optimisation in memory and reports per-image chosen format, before/after bytes, and measured quality. It clearly distinguishes itself from optimize_images by describing the analysis-only behavior and the sequencing relationship.

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

Usage Guidelines5/5

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

It explicitly instructs to use this first to show expected savings, then call optimize_images with the same arguments. It also gives practical usage context: try one subfolder first for hundreds of images, and the call can be cancelled.

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

Deploy Server

Other Tools