Skip to main content
Glama

Compress an image

compress_image
Read-onlyIdempotent

Re-encode an image at a quality from 1 to 100, optionally capping the longest edge. Send base64 or a public URL. Private addresses are refused and the decoded file is capped at 10 MB. Returns the image as base64.

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": {
      "file": "<file>"
    },
    "name": "compress_image"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesThe image. Provide url or data.
choiceNooriginal
maxEdgeNoLongest edge in pixels. Omit it to keep the size.
qualityNo

Output Schema

NameRequiredDescriptionDefault
dataYesCompressed image as base64.
mimeYes
noteYes
afterYes
bytesYes
labelYes
widthYes
beforeYes
formatYes
heightYes
qualityYes
filenameYes
extensionYes
savedBytesYes
keptOriginalYesTrue when compressing only made the file larger, so the original was returned.
savedPercentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • addedOutput schema / properties / keptOriginal
      Added value: +{
      +  "description": "True when compressing only made the file larger, so the original was returned.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / note
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "filename",
      -  "mime",
      -  "extension",
      -  "format",
      -  "quality",
      -  "width",
      -  "height",
      -  "bytes",
      -  "before",
      -  "after",
      -  "savedBytes",
      -  "savedPercent",
      -  "label",
      -  "data"
      -]New value: +[
      +  "filename",
      +  "mime",
      +  "extension",
      +  "format",
      +  "quality",
      +  "width",
      +  "height",
      +  "bytes",
      +  "before",
      +  "after",
      +  "savedBytes",
      +  "savedPercent",
      +  "label",
      +  "keptOriginal",
      +  "note",
      +  "data"
      +]
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: private/local addresses are refused, decoded input is capped at 10 MB, and output is returned as base64. It does not mention that output may change format with the choice parameter, which is the one behavioral gap.

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?

Four short sentences, front-loaded with the core action, then input modes, then limits and return format. No filler and nothing important buried.

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?

An output schema exists, yet the description helpfully still names the base64 return. Input source and limits are covered; the only omission is the choice/format parameter, which matters for predicting output type but is visible in the schema.

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 50%, and the description compensates for the undocumented quality parameter by stating its 1-100 range, and reinforces maxEdge's meaning. However, the choice enum (original/jpeg/png/webp/avif) and the nested file filename/mimeType fields get no mention, so half the surface is still schema-only.

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 ('Re-encode an image') plus the key knobs: quality range 1-100 and optional longest-edge cap. It implicitly distinguishes itself from resize_image by noting the cap is optional and secondary to re-encoding, but it never names a sibling to make the boundary explicit.

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?

Usage is implied by the quality/edge framing, and 'optionally capping the longest edge' hints when it overlaps with resize_image, but there is no explicit when-to-use/when-not guidance or named alternative such as convert_image or resize_image. The agent must infer the routing itself.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.