Skip to main content
Glama

Apply edits (batch)

apply_edits
Destructive

Apply multiple SVG edits as one atomic, reversible operation. Batch create, style, arrange, delete, or transform objects in a single call with all-or-nothing rollback.

Instructions

Apply an ordered list of typed DOM edits to a document as ONE atomic, reversible operation.

When to use: making SEVERAL edits to one document in a single call (draw + style + arrange, re-theme + rename, …) instead of N separate tool round-trips. Each member is the SAME typed edit the dedicated tool exposes — apply_edits adds atomicity + one snapshot, not new authority. For a single edit, call the dedicated tool (set_fill, move_object, …); for path geometry or cross-document composition use those tools directly (they are NOT batchable).

Key params: edits is a non-empty, ordered list (max 64) of typed edits, each tagged by an op field that selects its schema — e.g. {"op": "create_rect", "x": 0, "y": 0, "width": 100, "height": 60, "fill": "#3366cc"}, {"op": "set_fill", "object_ids": ["logo"], "color": "red"}, {"op": "move_object", "object_id": "logo", "dx": 10, "dy": 0}. Supported ops mirror the typed DOM tools: set_fill / set_stroke / set_opacity / replace_color / apply_palette / replace_text / set_font / duplicate_object / rename_object / delete_object (high) / move_object / scale_object / rotate_object / resize_canvas / normalize_viewbox / tile / create_rect / create_circle / create_ellipse / create_line / create_polygon / create_polyline / create_path / create_text / create_group / group_objects / reparent_object / create_use / add_linear_gradient / add_radial_gradient. Validation is two-phase: ALL members are validated before any mutation (one bad edit leaves the document byte-identical), then applied in order with all-or-nothing rollback on any failure. If ANY member is high-risk (a delete_object edit) the WHOLE batch is HIGH and requires a non-empty approval_token; otherwise it is medium.

Render and look before you trust the edit: a batch changes several things at once, so call render_preview (or live_render_view in live mode) afterwards and inspect the result before relying on it — and restore_snapshot(doc_id, snapshot_id) reverts the whole batch in one step.

Return shape: BatchEditResult — the pipeline fields for the single batch operation (operation_id, snapshot_id, changed, before/after preview; reversible) PLUS edit_count and the effective risk_class.

Example: apply_edits(doc_id, [{"op": "create_rect", "x": 0, "y": 0, "width": 100, "height": 60, "fill": "#eee", "object_id": "bg"}, {"op": "create_text", "x": 10, "y": 30, "text": "Hi"}])

Risk class: medium (effective risk is the MAX over members; a delete_object member escalates the batch to high and requires approval_token). Reversible via the single pre-batch snapshot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
editsYes
doc_idYes
approval_tokenNo

Output Schema

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

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

The description adds significant behavioral context beyond the annotations: it describes atomicity, reversibility, two-phase validation (validate-then-apply), all-or-nothing rollback, risk classification (medium vs high based on delete_object), requirement for approval_token for high risk, and the snapshot mechanism for revert. Annotations only indicate destructiveHint: true; the description enriches this with detailed operational behavior.

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?

The description is well-structured and front-loaded with the core purpose, then usage guidance, parameter details, validation, risk, and return shape. However, it is relatively verbose; while every sentence adds value, a slightly more condensed presentation could be achieved without losing clarity. Still, it's highly effective and organized.

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?

Given the tool's complexity (batch edits with many op types), the description is remarkably complete: it covers purpose, when to use, parameter semantics, validation behavior, risk levels, return shape (BatchEditResult with pipeline fields), and includes an example. The schema and annotations are supplemented well, and the description leaves no major gaps for an agent to invoke the tool correctly.

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?

The input schema has 0% description coverage for top-level parameters, so the description bears the full burden. It thoroughly explains the `edits` parameter: a non-empty ordered list (max 64) of typed edits, each with an `op` field, lists all supported ops, and provides examples. It also explains `approval_token` context (required for high risk). This adds extensive meaning beyond the schema's raw structure.

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?

The description clearly states: 'Apply an ordered list of typed DOM edits to a document as ONE atomic, reversible operation.' It distinguishes from siblings by specifying that for a single edit use the dedicated tool, and for path geometry or cross-document composition use those tools directly. This provides a specific verb+resource and differentiates from alternatives.

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?

The description explicitly includes a 'When to use' section: 'making SEVERAL edits to one document in a single call... instead of N separate tool round-trips.' It also states: 'For a single edit, call the dedicated tool... for path geometry or cross-document composition use those tools directly (they are NOT batchable).' This gives clear when-to-use and when-not-to-use guidance, referencing alternatives.

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