Skip to main content
Glama

svg_to_data_uri

Convert raw SVG markup into an optimized Data URI string for CSS background-image or HTML img tags, with utf8 or base64 encoding options.

Instructions

Convert raw SVG markup into an optimized Data URI string for CSS background-image or HTML tags.

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": "svg_to_data_uri"
  }
}

Input Schema

NameRequiredDescriptionDefault
svgYesThe raw SVG markup to encode.
encodingNoEncoding method: "utf8" (URL-encoded, smaller size) or "base64". Default is "utf8".utf8

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden and discloses relatively little. 'Optimized' hints that the SVG is minified or modified, but it never says what optimization means, whether scripts or external references are stripped (a real concern for SVG), how invalid markup is handled, or whether the operation is pure and side-effect free — all knowable facts an agent needs before calling it.

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?

A single front-loaded sentence with no filler; every clause either states the transformation or names a concrete use target. Nothing is buried or redundant.

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 pure transformation with no output schema, the description covers input, output form, and typical consumers, which is close to sufficient. The remaining gap is behavior on malformed or unsafe SVG, which matters somewhat less given the tool's stateless, single-step nature.

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%, including an enum with defaults and a size trade-off explanation for 'utf8' vs 'base64', so the schema does the heavy lifting. The description adds no parameter-level meaning beyond what the schema already states, which is the expected baseline here.

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 gives a specific verb ('Convert') and a precise input→output pair ('raw SVG markup' → 'optimized Data URI string'), so an agent knows exactly what goes in and what comes out. It stops short of differentiating itself from sibling tools such as sanitize_svg, leaving an agent to guess whether sanitization is a prerequisite or a separate step.

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?

The clause about CSS background-image and HTML <img> tags implies the downstream use case, which helps an agent decide when this tool is relevant. However, there is no explicit when-not guidance, no mention of running sanitize_svg first for untrusted markup, and no statement about which sibling produces the SVG this tool consumes.

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