apply_schematic_ops
Apply multiple LTspice schematic edits in one transaction: load once, run each operation, and save once. Reduces API round-trips for building or modifying circuits.
Instructions
Apply many .asc edits in one transaction. Loads the schematic once, runs each op against the in-memory editor in order, and saves once at the end. Cuts the typical 25+ tool calls to build a real circuit (add_component × N + connect × N + add_net_label × N + edit_directive × N) down to a single round-trip. This is also the home for the ack-only schematic mutations that have no standalone tool — they return no geometry to act on, so they live here rather than each costing a separate tool slot.
Supported ops (each tagged via the op field): add_component, set_component_value, set_component_attribute, remove_component, move_component, add_net_label, remove_net_label, remove_wire, connect, add_directive, remove_directive.
By default, the first op that raises aborts the whole transaction and nothing is written to disk. Set stop_on_error=false to run every op and persist whatever subset succeeded — useful when each op is independent and partial progress is acceptable. Errors are recorded under each op's error field; successes carry the per-op result keys (e.g. wire_count).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | List of edit operations applied in order against a single in-memory AscEditor. The file is saved once at the end iff every op succeeded (or stop_on_error=false). Each op is tagged by its ``op`` field; see the schema for per-op fields. | |
| path | Yes | Path to .asc schematic | |
| format | No | Response format: 'json' for structured data, 'text' for human-readable | |
| dry_run | No | When true, validate the whole batch against an in-memory copy and report per-op results WITHOUT writing the file — nothing is saved and the on-disk schematic is untouched. Every op is attempted (errors don't stop the run) so a single bad op surfaces all problems at once instead of rolling back a good batch. Use it to check a plan, then resubmit the corrected ops with dry_run=false. | |
| stop_on_error | No | When true (default), the first op that raises aborts the transaction and nothing is saved. When false, every op runs and per-op errors are recorded in ``results``; the file IS saved with whatever ops did succeed — set false only when failures are recoverable. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| saved | Yes | ||
| dry_run | No | ||
| results | Yes | ||
| failed_count | Yes | ||
| applied_count | Yes | ||
| validation_warnings | No |