Skip to main content
Glama

Transform objects (selector)

transform_objects
Destructive

Apply one typed operation to every object matching a selector, enabling bulk edits like recoloring, repositioning, or deleting objects based on their attributes.

Instructions

Apply ONE typed op to EVERY object a selector matches — one atomic, reversible operation.

When to use: bulk editing keyed by a predicate rather than by hand-listing ids — "recolour every blue rect", "nudge every text down 4px", "delete every object whose id starts with tmp-". It is find_objects (the SELECTOR) wired to ONE typed op fanned across the matches, run through the SAME atomic batch kernel as apply_edits. For a known id list call the dedicated tool (set_fill, move_object, …) or apply_edits directly; this adds NO authority — only the select-then-apply fan-out (ADR-002/003: no free text, no raw Action, no loops/expressions).

Key params: selector is the SAME predicate find_objects takes (tag / fill / stroke / text / id_prefix / bbox, full CSS-cascade paint match); operation is exactly ONE op tagged by an op field — the accepted set is set_fill / set_stroke / set_opacity / set_font / move_object / scale_object / rotate_object / delete_object (high), each with the SAME params as its dedicated tool MINUS the target ids (those from the selector), e.g. {"op": "set_fill", "color": "#3366cc"}, {"op": "move_object", "dx": 0, "dy": 4}. Document- wide ops (replace_color, apply_palette, resize_canvas, normalize_viewbox), element CREATION ops, and identity-conflicting per-id ops (rename_object, replace_text, duplicate_object) are NOT accepted — they are not meaningful applied identically per match. dry_run=True (DEFAULT) resolves + validates and returns the matched ids + the projected plan, writing NOTHING; dry_run=False performs it. max_matches (default 64) REJECTS an over-broad selector before any mutation. A delete_object op makes the operation HIGH and requires a non-empty approval_token.

Render and look before you trust it: a transform changes many objects at once — call render_preview (or live_render_view in live mode) afterwards and inspect the result, and restore_snapshot(doc_id, snapshot_id) reverts the WHOLE transform in one step.

Return shape: TransformObjectsResultmatched_ids + match_count, the effective risk_class, the dry_run flag, the projected plan (per-edit op + target id(s)); on a real run also applied / changed / summary and the single operation_id / snapshot_id (the revert target).

Example: transform_objects(doc_id, {"tag": "rect", "fill": "#3366cc"}, {"op": "set_fill", "color": "#ff0000"}, dry_run=False)

Risk class: medium (the effective risk is the op's class; a delete_object op escalates the operation to high and requires approval_token). Reversible via the pre-transform snapshot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
dry_runNo
selectorYesThe target selector — the SAME predicate fields `find_objects` takes (no new logic). Every supplied filter is ANDed; an unset filter is ignored. With no filters at all the selector matches every addressable object (then bounded by `max_matches`). `tag` is an exact local element name; `fill` / `stroke` match the EFFECTIVE cascade-resolved paint (casing- / shorthand- insensitive); `text` is a case-insensitive substring; `id_prefix` an id prefix; `bbox` an intersection box. `accurate_bbox` opts into geometry-accurate boxes (one read-only Inkscape `--query-all`) so transformed / path / text objects can match a `bbox`.
operationYes
max_matchesNo
approval_tokenNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
planYes
doc_idYes
appliedNo
changedNo
dry_runYes
summaryNo
risk_classYes
match_countYes
matched_idsYes
snapshot_idNo
operation_idNo
Behavior5/5

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

Adds extensive behavioral context beyond annotations: reversible via snapshot, dry_run default, risk class, approval_token for delete, and the atomic batch kernel. No contradictions 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 with front-loaded purpose, when-to-use, key params, caution, return shape, example, and risk. 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?

Given the complexity (6 params, nested objects, many siblings), the description covers all necessary aspects: purpose, usage, parameters, behavioral traits, return shape, example, risk, and reversibility. Output schema exists for return values, so further detail not needed.

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

Parameters4/5

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

Schema description coverage is low (17%), but the description provides rich semantic detail for selector (same as find_objects) and operation (oneOf each op with same params minus ids), plus explains dry_run, max_matches, and approval_token. This compensates well for the schema's minimal 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?

The description clearly states it applies one typed operation to every object a selector matches, using specific verbs and nouns. It distinguishes itself from sibling tools like find_objects and apply_edits by describing the select-then-apply fan-out pattern.

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 tells when to use (bulk editing by predicate) and when not to (known id lists use dedicated tools or apply_edits). Also lists operations that are NOT accepted, and provides safety guidelines like dry_run and max_matches.

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