fix: address review issues in get_wire_connections

- Fix critical bug: use pin_data[0]/[1] instead of pin_data["x"]/["y"]
  (get_all_symbol_pins returns List[float], not dict)
- Use index-based wire tracking to avoid fragile float list equality
- Check all polyline points (not just endpoints) during flood-fill
- Add spatial index (0.05mm grid) to replace O(n²) frontier scan
- Skip already-processed refs to avoid redundant calls for multi-unit symbols
- Include wires_out in early return when schematic has no symbols
- Add get_wire_connections schema entry to tool_schemas.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Eugene Mikhantyev
2026-03-14 14:10:06 +00:00
parent 6633cd59fd
commit ddbfc62a49
2 changed files with 85 additions and 25 deletions

View File

@@ -1471,6 +1471,29 @@ SCHEMATIC_TOOLS = [
"required": ["schematicPath", "netName"],
},
},
{
"name": "get_wire_connections",
"title": "Get Wire Connections",
"description": "Returns all wires and component pins connected to the wire at a given point, by flood-filling through touching wires.",
"inputSchema": {
"type": "object",
"properties": {
"schematicPath": {
"type": "string",
"description": "Path to schematic file"
},
"x": {
"type": "number",
"description": "X coordinate of the point on the wire"
},
"y": {
"type": "number",
"description": "Y coordinate of the point on the wire"
}
},
"required": ["schematicPath", "x", "y"]
}
},
{
"name": "get_schematic_pin_locations",
"title": "Get Schematic Pin Locations",