Skip to main content
Glama

Replace text

replace_text
Destructive

Replace the text content of a text element in an SVG document. Use this to change what a text object says, with the edit being reversible on the working copy.

Instructions

Replace the text content of a text element (<text> / <tspan> / flow text).

When to use: changing what a text object says (get its id from find_objects). To change the font/size use set_font; to rename the element's id use rename_object.

Key params: object_id must be a text-bearing element; text is length-bounded and may not contain control characters other than tab / newline / carriage return. If the <text> has <tspan> children they are dropped and the content collapses to a single run.

Return shape: EditResultoperation_id, snapshot_id, changed, before/after preview; the edit lands on the working copy only (reversible).

Example: replace_text(doc_id, "title", "Hello")

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 (reversible text edit on the working copy; original untouched).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
doc_idYes
object_idYes

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?

Discloses critical behavioral details: `<tspan>` children are dropped, content collapses to single run, edit is on working copy only and reversible. Annotations already indicate `destructiveHint: true` and `readOnlyHint: false`, but description adds nuance about reversibility and risk level. No contradiction.

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?

Well-structured with sections for purpose, usage, params, return shape, example, and risk. However, some sentences are slightly verbose (e.g., 'Render and look before you trust this edit'). Still efficient overall.

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?

Covers all aspects: purpose, usage, params, behavior (child handling), return shape, example, and risk. Output schema exists but description still explains `EditResult` fields. Complete for a medium-risk text editing tool.

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?

Schema coverage is 0%, so description fully compensates by explaining `object_id` must be a text-bearing element and `text` has length and character restrictions. Also provides concrete example mapping parameters.

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 it replaces text content of text-bearing elements like `<text>` and `<tspan>`, with specific examples. Distinguishes itself from siblings like `set_font` and `rename_object`.

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?

Explicitly states when to use (changing what text says) and when not to (for font/size use `set_font`; for renaming use `rename_object`). Provides example and links to `find_objects` for obtaining IDs.

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