Skip to main content
Glama

SVG to React component

svg_to_react
Read-only

Convert SVG code into a React component with svgo optimization, JSX attribute names, and root prop spreading for external size, color, and aria-label control.

Instructions

Converts an SVG (e.g. from get_icon) into a React component: optimized with svgo, JSX attribute names, and props spread on the root so size, color and aria-label can be set from outside.

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_react"
  }
}

Input Schema

NameRequiredDescriptionDefault
svgYesFull SVG code
nameNoPascalCase component nameIcon
optimizeNo
typescriptNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.1

TDQS

A4/5.0
Behavior4/5

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

Beyond the readOnlyHint/openWorldHint annotations, the description discloses what the transformation actually does: svgo optimization, JSX attribute renaming, and spreading props on the root so size, color and aria-label can be set externally. That is concrete, non-obvious output behavior worth having.

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?

A single front-loaded sentence naming the conversion first, then the three behavioral details. Nothing is repeated from the name or title and no sentence is wasted.

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?

With no output schema, the description does the necessary work of explaining the shape of the generated component (JSX attributes, root props). It stops short of saying whether the result is returned as a code string versus written to a file, and says nothing about the typescript flag.

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%; the description only touches the svg input and the optimization behavior (implicitly the optimize flag, though it reads as unconditional rather than toggleable). The name and typescript parameters get no added meaning beyond the schema, so the baseline of 3 applies.

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 and resource ('Converts an SVG ... into a React component') and names the producing sibling ('e.g. from get_icon'), so the agent can distinguish this from optimize_svg or get_icon without opening the schema.

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 'e.g. from get_icon' clause implies a fetch-then-convert pipeline and therefore when to reach for it, but there is no explicit guidance on when not to use it, nor any distinction from optimize_svg, which likely overlaps on the svgo step.

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