Skip to main content
Glama

Replace color

replace_color
Destructive

Replace every occurrence of a specified color with another color across an entire SVG document or within selected elements.

Instructions

Replace one colour with another across the document (or within scope_ids subtrees).

When to use: swapping every occurrence of one colour for another. For a multi-colour theme swap use apply_palette; to recolour specific objects only use set_fill / set_stroke.

Key params: both colours are validated; matching is case- and hex-shorthand-insensitive and covers inline-style colour properties (fill, stroke, stop-color, ...) and the same-named presentation attributes. scope_ids, if given, confines the replacement to those elements' subtrees (each id must exist).

Return shape: EditResultoperation_id, snapshot_id, changed (false if the colour was not found anywhere in scope), before/after preview; lands on the working copy only (reversible).

Example: replace_color(doc_id, "#ff0000", "#3366cc")

Render and look before you trust this edit: render with render_preview (or live_render_view) and inspect the result before relying on it; restore_snapshot reverts it if it is wrong.

Risk class: medium.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
to_colorYes
scope_idsNo
from_colorYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
changedYes
summaryNo
snapshot_idYes
operation_idYes
preview_afterNo
preview_beforeNo
Behavior5/5

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

Beyond annotations (destructiveHint=true), description adds color matching behavior (case- and hex-shorthand-insensitive, covers inline and presentation attributes), scope_ids validation, return shape EditResult, reversible nature, and preview recommendation. No contradiction with annotations.

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?

Well-structured: one-sentence purpose, usage guidance, key params with details, return shape, example, safety note. Every sentence adds value, no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Complete for a mutation tool with 4 params: explains parameters, behavior, return shape, side effects, and risk mitigation. No gaps given annotations and output schema (EditResult described).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, description explains scope_ids (confines to subtrees, ids must exist), from_color/to_color validation and matching semantics, and provides an example. Compensates fully for missing schema descriptions.

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?

Description clearly states 'Replace one colour with another' with explicit scope (document or scope_ids subtrees). Differentiates from siblings like apply_palette and set_fill/set_stroke.

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?

Explicit 'When to use' section with clear guidance on when to use this tool vs alternatives (apply_palette for multi-colour, set_fill/set_stroke for specific objects).

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/jjjsood/inkscape-mcp-server'

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