Add query_zones tool for auditing copper pours (#174)

query_traces silently omits PCB_ZONE_T objects, so layer-usage audits
miss power planes and GND pours entirely. query_zones complements it by
iterating board.Zones() and returning each zone's net, layers, priority,
fill state, min thickness, bounding box, and filled area, with the same
net/layer/boundingBox filter surface as query_traces.
This commit is contained in:
kevargaso
2026-05-18 13:40:18 -05:00
committed by GitHub
parent 4e845f24ce
commit 40d6d6bba1
5 changed files with 182 additions and 0 deletions

View File

@@ -912,6 +912,39 @@ ROUTING_TOOLS = [
},
},
},
{
"name": "query_zones",
"title": "Query Zones",
"description": "Queries copper zones (filled pours) on the board with optional filters by net, layer, or bounding box. Returns one entry per zone with net, layers, priority, fill state, and bounding box. Useful for auditing power planes and GND pours, which 'query_traces' does not include.",
"inputSchema": {
"type": "object",
"properties": {
"net": {
"type": "string",
"description": "Filter by net name (e.g., 'GND', '+3V3')",
},
"layer": {
"type": "string",
"description": "Filter by layer name (e.g., 'In1.Cu', 'B.Cu'). Matches zones that include this layer in their layer set.",
},
"boundingBox": {
"type": "object",
"description": "Filter to zones whose bounding box overlaps this region",
"properties": {
"x1": {"type": "number", "description": "Left X coordinate"},
"y1": {"type": "number", "description": "Top Y coordinate"},
"x2": {"type": "number", "description": "Right X coordinate"},
"y2": {"type": "number", "description": "Bottom Y coordinate"},
"unit": {
"type": "string",
"enum": ["mm", "inch"],
"default": "mm",
},
},
},
},
},
},
{
"name": "modify_trace",
"title": "Modify Trace",