Find objects
find_objectsFind object IDs in SVG documents by filtering on tag, fill, stroke, text, ID prefix, or bounding box. Use before editing to target specific elements.
Instructions
Find addressable object ids in a tracked document by tag / paint / text / id-prefix / bbox.
When to use: before an id-taking edit (set_fill, move_object, replace_text,
rotate_object, …) on a document the agent did not author, or to enumerate "every blue rect",
"every text mentioning 'Total'", etc. For the full structural picture (tree / layers / styles /
fonts / assets) plus the same list use inspect_document; to map a goal to a tool, how_do_i.
Key params (all filters optional; supplied filters AND together; none → every addressable
object): tag exact local name ("rect"/"text"/"path"); fill/stroke a paint matched
casing- and hex-shorthand-insensitive ("#FFF" matches "#ffffff") — matching resolves the
FULL CSS cascade so an object painted via a <style> rule / class / id selector or INHERITED
from an ancestor <g> is matched too (the reported fill/stroke stay the per-element
authored token); text a case-insensitive substring of text content; id_prefix an id
prefix; bbox an {x, y, width, height} box kept on INTERSECTION. By default bbox uses the
attribute-derived box and objects with no derivable box (path/text/group/transformed) are
EXCLUDED; set accurate_bbox=true to compute geometry-accurate, transform-/outline-aware boxes
via one batched Inkscape --query-all call (so those objects can match) — it degrades to the
attribute box when the Inkscape engine is unavailable.
Return shape: FindResult — {doc_id, count, objects: [{object_id, tag, bbox?, fill?, stroke?, text?}]}. Objects without an id are never returned (they cannot be targeted). With
accurate_bbox=true, bbox carries the engine box where one was reported.
Example: find_objects("d_ab12", tag="rect", fill="#3366cc")
Risk class: low for the default direct-DOM path (read-only, ADR-005; no snapshot / Operation
Record); accurate_bbox=true adds a read-only Inkscape --query-all invocation (medium, still
no mutation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | ||
| bbox | No | ||
| fill | No | ||
| text | No | ||
| doc_id | Yes | ||
| stroke | No | ||
| id_prefix | No | ||
| accurate_bbox | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | ||
| doc_id | Yes | ||
| objects | Yes |