Graphite: insert SVG as editable artwork
graphite_insert_svgInsert SVG markup or a local SVG file into a Graphite document as editable vector layers, converting text to outlines for native hand-editing.
Instructions
Insert SVG markup into the active Graphite document as an editable group layer (each SVG element becomes its own vector layer; the user can keep editing it by hand). This is the main way to create artwork: generate the SVG yourself, then call this with either svg (inline markup) or svg_path (a local file; preferred for anything large). Returns the new layer_id. The operation is one undo step. is converted to outlined paths automatically (Graphite cannot render text from SVG); pass outline_text=false to skip that. Large artwork is slow to build (roughly 40 ms per element); the wait scales with the element count. Fails with NO_ACTIVE_DOCUMENT if no document is open (call graphite_new_document first), INVALID_SVG if the markup does not parse, and BRIDGE_TIMEOUT if Graphite has not reported the layer in time even after a grace period — in that case call graphite_get_document and look for the returned layer_id before retrying, because the layer may still appear and a retry would duplicate it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Horizontal position in document units (pixels). With center=false this is the left edge of the SVG viewBox. | |
| y | No | Vertical position in document units; y grows downward. With center=false this is the top edge of the SVG viewBox. | |
| svg | No | Complete SVG markup starting with <svg …>. Give it a viewBox and explicit width/height; gradients, groups, paths, basic shapes and text are supported (<text> is converted to outlined paths by the connector, see outline_text). Provide either svg or svg_path. | |
| name | No | Optional layer name shown in the Layers panel. | |
| center | No | When true, (x, y) becomes the visual centre of the artwork instead of its top-left corner. | |
| svg_path | No | Absolute path of a local SVG file to insert instead of inline markup. Prefer this for large artwork (hundreds of elements): the file is read by the connector, so the markup is not re-sent on every call. | |
| parent_id | No | Optional layer_id of a group or artboard to insert into. Omit to insert at the document root. | |
| outline_text | No | Convert <text> elements to outlined paths before inserting (default). Graphite's web build cannot render text itself. Uses the bundled Liberation Sans/Serif/Mono faces, or fonts from GRAPHITE_MCP_FONT_DIR matched by family name; italic is synthesised. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| elements | Yes | Number of SVG elements sent; each becomes a layer. | |
| layer_id | Yes | Node id of the new group layer, as a decimal string. Refer to it in later edits. | |
| document_id | Yes | Active document the layer was inserted into, when known. | |
| text_outlined | Yes | Number of <text> elements converted to paths before inserting. | |
| confirmed_late | Yes | True when the bridge's wait expired but graphite_get_document then showed the layer, so nothing needs to be retried. |