Skip to main content
Glama
AndreyTsibin

mcp-super-app

by AndreyTsibin

Optimize images

optimize_images

Optimize images for the web by downscaling to a max width, converting to WebP/JPEG/AVIF, and generating responsive srcset variants, replacing heavy originals to keep production lean.

Instructions

Resize and re-encode images for production web use via sharp: downscale to max_width (default 1920, never upscales), convert to webp (default; jpeg/avif available), auto-apply EXIF rotation, optionally emit extra srcset variants (widths → name-.webp). By default the source file is replaced by the optimized output so heavy originals don't leak into production; keep_originals: true preserves them. Accepts files or directories. Returns final dimensions (use them for width/height) and sizes before/after. Typical landing use: generate images into assets/img, then optimize the whole directory in one call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesImage files and/or directories (absolute, or relative to the project cwd). A directory takes every supported image at its top level (png/jpg/webp/avif/tiff).
formatNoOutput format. Default: webp (best size/support balance for the web).
widthsNoExtra downsized variants for srcset, e.g. [800] → name-800.webp next to the main file. Variants wider than the source are skipped.
qualityNoEncode quality. Defaults: webp/jpeg 80, avif 60.
max_widthNoResize down to this width, keeping aspect ratio; never upscales. Default: 1920.
keep_originalsNoKeep source files after conversion. Default false: the source is replaced by the optimized output (prevents heavy originals leaking into production).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesOptimized files with their output variants (sizes for <img> width/height).
skippedYesInputs that could not be processed.
total_kb_afterYesTotal size of main outputs (srcset variants excluded).
total_kb_beforeYes
Behavior4/5

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

With no annotations, the description fully discloses the destructive default: 'the source file is replaced by the optimized output' and explicitly notes how to preserve originals. It also discloses other behavioral traits like never upscaling, auto-applying EXIF rotation, and returning final dimensions for <img> tags — all beyond what any annotation would provide. It does not mention error handling or permission requirements, but the core behavioral risks are well covered.

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?

The description is dense but well-organized, front-loading the core operation (resize/re-encode) before detailing optional behavior and usage guidance. Each sentence earns its place, covering defaults, side effects, and a concrete use case. Slightly long but every part is functional; the final 'Typical landing use' sentence is actionable rather than filler.

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?

Given no annotations, the description thoroughly compensates: it explains the destructive default, the returned dimensions and sizes, directory support, and the typical workflow. The output schema exists, so the description correctly avoids detailing return fields further. The only gap is the absence of mention of required permissions or error scenarios, but for a local file-processing tool this is acceptable.

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 100%, so the description does not need to repeat every parameter definition. It adds semantic context for key parameters like max_width (default 1920, never upscales), format (webp default; jpeg/avif available), widths (srcset variants, wider variants skipped), and keep_originals (default false meaning replacement). This adds value beyond the schema while staying within the baseline-3 expectation for high coverage.

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 clearly states the tool resizes and re-encodes images for production web use via sharp, listing specific operations (downscale, convert to webp, EXIF rotation, srcset variants) and distinguishing its scope from siblings like create_image or create_website. It names the resource (images) and the verb (optimize/resize/re-encode), making the purpose unambiguous and differentiated.

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?

The description explicitly states when to use it ('Typical landing use: generate images into assets/img, then optimize the whole directory in one call') and implies alternatives by contrast ('heavy originals don't leak into production', 'keep_originals: true preserves them'). It provides clear context for accepting files or directories and notes default vs. optional behaviors, giving the agent enough guidance for invocation.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AndreyTsibin/mcp-super-app-public'

If you have feedback or need assistance with the MCP directory API, please join our Discord server