Skip to main content
Glama

Shrink an image or video for the web without visible loss

media_optimize

Optimize images and videos for web uploads: convert images to WebP/JPEG/PNG and videos to H.264 faststart, shrinking file size to an SSIM quality target while keeping originals untouched.

Instructions

Images to WebP by default, or JPEG/PNG with format (or a .jpg/.png output_path), for places like LinkedIn post uploads that don't take WebP. Videos to H.264 with faststart. Raises quality until SSIM (similarity to the original) reaches the target, so the size drops but the picture does not visibly change. The original is kept untouched. Behaviour notice: by default the output has embedded metadata stripped (EXIF, XMP, C2PA content credentials, text chunks), like most web image optimizers; the result lists what was removed. Pass keep_metadata: true to keep what re-encoding can carry. Invisible watermarks such as SynthID are never touched.

Input Schema

NameRequiredDescriptionDefault
formatNoImage output format. Default: from output_path's extension, else webp
max_widthNo
overwriteNo
input_pathYes
keep_audioNo
output_pathNoDefault: same folder, .webp for images (or the chosen format), -web.mp4 for videos
keep_metadataNotrue: don't strip embedded metadata from the output (EXIF/XMP/C2PA). Default follows config strip_ai_metadata (on).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.4.1

TDQS

A3.8/5.0
Behavior4/5

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

Without annotations the description carries the full burden and does most of it well: it discloses the default metadata stripping (EXIF, XMP, C2PA, text chunks), notes the result lists what was removed, offers keep_metadata as an escape hatch, and states the invisible-watermark and original-file guarantees. Gaps remain on the overwrite semantics, keep_audio, and error behavior.

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?

Front-loaded with the primary outcome and format behavior, then the quality mechanism, then the metadata warning. The 'Behaviour notice' paragraph is long but earns its place given no annotations exist; a slightly tighter phrasing of the metadata sentence would improve it.

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?

Good coverage of the destructive-surprise axis (metadata stripping, original preservation) and a partial return-value hint ('the result lists what was removed') in the absence of an output schema. But for a 7-parameter mutation tool it leaves overwrite, max_width, and keep_audio wholly unexplained, which is a real completeness gap for calling it correctly.

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 coverage is only 43%, so the description must compensate. It does add real meaning for format/output_path fallback logic and keep_metadata (including the config dependency that the schema only hints at), but max_width, overwrite, and keep_audio are documented nowhere — those three are fully silent.

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 (optimize/shrink) applied to a specific resource (image or video), and enumerates the concrete transformations: WebP/JPEG/PNG for images, H.264 with faststart for video, size reduced via SSIM-targeted quality. This clearly separates it from media_cleanup, media_probe, and video_edit in the sibling list.

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?

Provides one concrete usage context ('places like LinkedIn post uploads that don't take WebP'), which is genuinely useful for routing. However, there is no explicit when-not guidance and no named sibling alternative (e.g. 'use media_probe first to inspect' or 'use media_cleanup to remove files'), so the agent must infer the rest of the decision boundary.

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