Skip to main content
Glama

optimizar_imagen

Optimize images by converting formats and finding the lowest quality that meets a target SSIMULACRA 2 score, saving results to new files. Supports WebP, AVIF, JPEG XL, JPEG, PNG, and QOI with resize and crop.

Instructions

Optimizes an image and saves it as a NEW file (next to the original, or in salida; if the name exists, -2, -3…). Without a quality, it searches for the lowest one that gives a SSIMULACRA 2 score of 80. Gives the equivalent command for cwebp, cjpeg, oxipng, avifenc or cjxl. To choose between formats, comparar_formatos; for many images, empezar_lote. Examples: {"ruta": "/a.jpg"} · {"ruta": "/a.png", "formato": "avif", "nota_objetivo": 85} · {"ruta": "~/a.jpg", "formato": "webp", "orden": "-q 80 -m 6", "ancho": 1600} For the person's images, use it instead of converting them yourself in another environment (a cloud interpreter): it works with the file on their disk, with the official engines. Apolo doesn't see images attached to the conversation: if one is attached, ask for its path.

Input Schema

NameRequiredDescriptionDefault
altoNoMaximum height, in pixels: scales down if larger and never enlarges (with ancho alone, proportional).
rutaYesAbsolute path of the image (~ is accepted).
anchoNoMaximum width, in pixels: scales down if larger and never enlarges (with alto alone, proportional).
medirNoAlso measure PSNR and SSIM (the score is already measured when searching for it).
ordenNoOptions of the official tool, as they are: “-q 80 -m 6” (cwebp), “-quality 85 -progressive” (cjpeg), “-o 4” (oxipng), “-q 60 -s 6” (avifenc), “-d 1 -e 7” (cjxl). It may start with the tool's name. For its format, it replaces the preset's options.
paletaNoReduce the palette to this number of colors (2 to 256), with dithering: mainly for PNGs of logos, icons and screenshots.
presetNoA saved preset (listar_presets lists them). It is the base for everything else.
salidaNoWhere to put it: a folder, or a file with the format's extension. By default, next to the original. Nothing is ever overwritten.
calidadNoFixed quality from 0 to 100. Not together with nota_objetivo.
formatoNowebp, jpeg, png, qoi, avif or jxl. By default, the preset's, or webp.
recorteNoCrop to this rectangle, before resizing (in pixels of the already auto-rotated image; whatever goes past the edge is trimmed).
enderezarNoAuto-rotate according to the EXIF orientation if the photo needs it. Yes by default.
lado_mayorNoMaximum longest side, in pixels: the width if landscape, the height if portrait; never enlarges. Not together with ancho, alto or porcentaje.
porcentajeNoReduce to this percentage (50 = half the width and height). From above 0 to 100. Not together with ancho, alto or lado_mayor.
sin_perdidaNoLossless (WebP, AVIF, JPEG XL). PNG and QOI always are.
nota_objetivoNoSearch for the lowest quality that gives this SSIMULACRA 2 score (90 indistinguishable; 80 very high; 70 high; 50 medium). Takes a few seconds.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnly=false, destructive=false, idempotent=false) by disclosing that nothing is overwritten and collisions get -2, -3 suffixes, that omitting quality triggers an SSIMULACRA 2 search (costing a few seconds), and that processing happens against the user's local files with official engines. This makes the non-idempotent, non-destructive write semantics concrete.

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?

Dense but front-loaded: purpose, then default behavior, then sibling routing, then examples, then environment caveats. Every sentence carries information, though the examples block and the 'official engines' justification could be trimmed without loss.

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?

For a 16-parameter tool with no output schema, the description still explains the primary return ('gives the equivalent command for cwebp, cjpeg, oxipng, avifenc or cjxl') and the default decision path. It does not explicitly state whether the created file's path is returned, which is the one thing an agent might still need to discover.

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 adds real value on top by stating the default target score of 80 when no quality is given, the default format (webp), and showing three concrete parameter combinations. The examples are illustrative rather than explaining every optional parameter, which the schema already handles.

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?

States a specific verb+resource ('Optimizes an image and saves it as a NEW file') with output-location and collision-naming behavior spelled out. It explicitly distinguishes itself from sibling workflows for format choice and batching, so an agent can place it immediately.

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?

Names the alternatives with their selecting conditions ('To choose between formats, comparar_formatos; for many images, empezar_lote') and adds a strong negative rule: don't convert images yourself in a cloud interpreter, use this so the file stays on the user's disk with the official engines. It even covers the edge case of images attached to the conversation, telling the agent to ask for a path.

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