Skip to main content
Glama

Optimize SVG

optimize_svg
Read-only

Compress SVG code locally with SVGO to reduce file size, returning the optimized SVG and before/after size measurements. Set coordinate precision as needed.

Instructions

Optimizes an SVG locally with svgo (the engine behind SVGOMG). Returns the SVG and its size before and after.

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": {
      "svg": "<svg>"
    },
    "name": "optimize_svg"
  }
}

Input Schema

NameRequiredDescriptionDefault
svgYesFull SVG code
precisionNoDecimal places in coordinates

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, and the description usefully reinforces this by stating the work happens "locally" and that the engine is svgo. It also discloses the return payload (SVG plus before/after sizes), but says nothing about whether optimization is lossy, how precision affects visual fidelity, or whether output can be re-run idempotently.

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?

Two tight sentences with zero filler; the core operation is front-loaded and the return contract follows immediately. Every clause contributes information.

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 simple two-parameter, non-destructive tool with no output schema, the definition covers what it does, that it runs locally, and what it returns. The only meaningful omission is the tradeoff implied by the precision parameter, which an agent would have to guess at.

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 both parameters (svg, precision) are already fully documented at the field level, which sets the baseline at 3. The description adds no extra meaning about the required SVG format or how the precision parameter trades size against coordinate accuracy.

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?

The description names a specific verb and resource ("Optimizes an SVG") and identifies the underlying engine (svgo / SVGOMG), which tells an agent exactly what operation is performed. It does not differentiate from siblings, but the sibling set (icons, gradients, contrast checks) is unrelated enough that no routing ambiguity exists.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance, no mention of prerequisites, and no comparison to any alternative tool for shrinking or transforming SVG. An agent must infer that it should be called whenever it has raw SVG markup to shrink.

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