Add copper query and net tie authoring tools for PCB routing#422
Merged
Conversation
…-tie tools Three new MCP tools close the read/author gaps around add_*/delete_*: - get_copper: the read/query companion to add_trace/delete_trace. Filters by layer/net/bbox/kind and returns each trace/arc/via/zone with the same per-collection index the delete_* tools accept, so an agent can discover copper and drive a surgical delete without exporting the document (describe_pcb only aggregates counts). Capped at 200 per page with offset pagination and an uncapped total. - add_net_tie: author an intentional net junction (vcad_ir::ecad::NetTie) on the live session — wye/star neutrals, split grounds, and current-sense shunts require ties, but only the add_motor_winding realizer could write them; hand-building a wye meant offline JSON surgery on the saved .vcad. Validates the nets exist, and fails closed on a half-scoped region (position without radius would silently become a board-wide exemption in NetTieGroups). Returns the updated tie list. - delete_net_tie: the take-back — by index, or by matching nets (set equality) and/or position, with the same index+filter guard semantics as delete_trace/delete_via. Both mutators are registered as doc writers (persisted + undoable), and undo's changed diff now reports netTie churn. Server instructions grow a "surgical copper edits" sentence in the PCB workflow blurb. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0149H9KjqeyjkVWEihNjMvJS
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
What shippedThree new tools are available for PCB work in this release.
Plain-English summary generated by Choji from this pull request. |
ecto
pushed a commit
that referenced
this pull request
Jul 7, 2026
add_net_tie / delete_net_tie (merged from main, #422) postdate the drc_delta contract but mutate DRC semantics directly: a tie exempts short/clearance findings at a junction, and deleting one re-convicts the junction copper as a live short. Wrap both in the same before/after capture — a region-scoped tie snapshots its circle, a board-wide tie snapshots the whole board. add_net_tie on an intended junction now reports the short it resolved (clean, resolved >= 1); delete_net_tie reports the short it exposed (clean: false, shorts >= 1). Tested with the symmetric short -> tie -> untie round trip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WMn4sMTRARjMBJxMgewqt
ecto
added a commit
that referenced
this pull request
Jul 7, 2026
#438) * feat(pcb): verify-on-write drc_delta on every copper-mutating MCP tool Field report: add_motor_winding returned a bare document_version for a board it had just shorted in 3 places and islanded in 3 more — the agent only learned from a separate run_drc. Every copper mutator now wraps its mutation in a before/after DRC snapshot and self-reports what it introduced. - Extract the route_nets receipt diff core into a shared helper: diffViolations (multiset identity, @vcad/core receipt engine) + drcDelta(before, after) in the MCP ecad tools — introduced/resolved counts, categories (shorts/clearance/connectivity/manufacturing), a worst-first capped sample with positions, and `clean` to branch on. - Attach `drc_delta` to add_trace, add_via, add_via_array, add_coil, add_coil_array, add_motor_winding, delete_trace, delete_via, delete_zone, set_board_outline, and set_stackup (verified no-op). Composite tools capture once around the whole batch. - Incremental scope: boards with >= 2000 elements snapshot via a new bbox-scoped kernel entry point check_drc_in_region (vcad-ecad-pcb), which filters the geometric checks' subjects to the mutation's inflated bbox while connectivity (shorts/islands) stays board-global — behind a region parameter on the existing rule logic, not a fork of it. Exposed as ecadCheckDrcInRegion in kernel WASM with a full-DRC fallback for stale artifacts. - kernel-wasm build: re-canonicalize glue call sites that wasm-bindgen aliased onto a merged twin's export name (LLVM ICF), so the glue-drift gate keeps meaning "mis-wired" rather than "rebuilt with a newer rustc". Rebuilt artifacts include the new binding. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WMn4sMTRARjMBJxMgewqt * chore(mecheval): cache leaderboard SVG rendered during workspace build The leaderboard build step renders any run .vcad missing from the checked-in SVG cache; this one (f3-clip-pipe-01 / wafer-direct-GLM-5.2) had never been cached. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WMn4sMTRARjMBJxMgewqt * feat(pcb): extend verify-on-write drc_delta to the net-tie tools add_net_tie / delete_net_tie (merged from main, #422) postdate the drc_delta contract but mutate DRC semantics directly: a tie exempts short/clearance findings at a junction, and deleting one re-convicts the junction copper as a live short. Wrap both in the same before/after capture — a region-scoped tie snapshots its circle, a board-wide tie snapshots the whole board. add_net_tie on an intended junction now reports the short it resolved (clean, resolved >= 1); delete_net_tie reports the short it exposed (clean: false, shorts >= 1). Tested with the symmetric short -> tie -> untie round trip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WMn4sMTRARjMBJxMgewqt --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three new MCP tools for PCB copper inspection and net tie management, completing the read/write algebra for routed copper and intentional net junctions.
Key Changes
get_coppertool — Query the board's routed copper (traces, trace arcs, vias, zones) with optional filters by layer, net, bounding box, and kind. Returns each element with itsindex(compatible with delete tools) and geometry, enabling surgical edits without exporting the document. Supports pagination withoffset/limit(capped at 200 elements per page).add_net_tietool — Declare intentional junctions between two or more nets (e.g., wye motor neutral points, split-ground stitches, current-sense shunt taps). Supports both board-wide ties and region-scoped ties (position + radius). Validates that all nets exist on the board and rejects half-scoped regions (position without radius or vice versa).delete_net_tietool — Remove a net tie by index, by matching net set (order-insensitive), or by position (±0.001 mm tolerance). Supports guards: passingnetsorpositionalongsideindexconfirms the indexed tie matches before deletion.Net tie diffing — Extended
PcbElementChangeto include"netTie"kind and updateddiffPcbElementsto track tie mutations in thechangeddiff (ties report their joined nets as"A+B+C"since they have no single net).Copper element bounding boxes — Added
copperElementBboxhelper to compute conservative axis-aligned bounds for traces, trace arcs, vias, and zones (full-circle bound for arcs to avoid missing copper on bbox queries).Via layer spanning — Added
viaSpansLayerto check if a via's barrel spans a given copper layer (e.g., a through via FCu→BCu carries In1Cu).Schema and validation — Added JSON schemas for all three tools with comprehensive property descriptions. Validation includes layer name normalization, net existence checks, and bbox geometry validation.
Test coverage — Added comprehensive tests for
get_copper(filtering, pagination, index-driven deletes),add_net_tie(board-wide and region-scoped ties, validation), anddelete_net_tie(index/net/position matching, guards, DRC integration). Includes an end-to-end test showing that a region-scoped tie exempts a junction short in DRC, and deleting it re-arms the violation.Server integration — Registered all three tools in the MCP server, marked
add_net_tieanddelete_net_tieas document writers (they mutate the session and must persist/be undoable), and updated the PCB workflow blurb in the server instructions.Implementation Details
get_copperreports bbox + vertex count instead of the full outline to keep responses bounded.run_drcaccepts, so they must persist and be undoable like other mutations.delete_net_tieposition matching uses the same ±0.001 mm tolerance, so echoing a position fromadd_net_tie's result always matches.add_net_tiefails closed on a half-scoped region: the kernel'sNetTieGroupsonly forms a region when both position and radius are present, so passing one without the other would silently degrade to a board-wide exemption.https://claude.ai/code/session_0149H9KjqeyjkVWEihNjMvJS