Replace text
replace_textReplace 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: EditResult — operation_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
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| doc_id | Yes | ||
| object_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | ||
| changed | Yes | ||
| summary | No | ||
| snapshot_id | Yes | ||
| operation_id | Yes | ||
| preview_after | No | ||
| preview_before | No |