docs: clarify get_wire_connections requires endpoint coordinates

Update tool description and Python docstring to make clear that the
query point must be at a wire endpoint or junction — midpoints of
wire segments are not matched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Eugene Mikhantyev
2026-03-14 16:43:06 +00:00
parent de0eca2ed7
commit 8414784b78
2 changed files with 8 additions and 4 deletions

View File

@@ -160,10 +160,14 @@ def _find_pins_on_net(
def get_wire_connections(schematic, schematic_path: str, x_mm: float, y_mm: float) -> Optional[Dict]: def get_wire_connections(schematic, schematic_path: str, x_mm: float, y_mm: float) -> Optional[Dict]:
"""Find all component pins reachable from a point via connected wires. """Find all component pins reachable from a point via connected wires.
The query point (x_mm, y_mm) must be within _QUERY_TOLERANCE_IU (0.5 mm) of
a wire endpoint or junction. Interior (mid-segment) points are not matched —
use wire endpoint coordinates obtained from the schematic data.
Returns dict with keys: Returns dict with keys:
- "pins": list of {"component": str, "pin": str} - "pins": list of {"component": str, "pin": str}
- "wires": list of {"start": {"x", "y"}, "end": {"x", "y"}} in mm - "wires": list of {"start": {"x", "y"}, "end": {"x", "y"}} in mm
Or None if no wire found at the query point. Or None if no wire endpoint found within tolerance of the query point.
""" """
all_wires = _parse_wires(schematic) all_wires = _parse_wires(schematic)
if not all_wires: if not all_wires:

View File

@@ -428,11 +428,11 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
// Get wire connections // Get wire connections
server.tool( server.tool(
"get_wire_connections", "get_wire_connections",
"Find all component pins reachable from a schematic point via connected wires. Provide any point on a wire (start, end, or junction) to get all pins on that net.", "Find all component pins reachable from a schematic point via connected wires. The query point must be at a wire endpoint or junction — midpoints of wire segments are not matched. Use get_schematic_pin_locations or list_schematic_wires to obtain exact endpoint coordinates first.",
{ {
schematicPath: z.string().describe("Path to the schematic file"), schematicPath: z.string().describe("Path to the schematic file"),
x: z.number().describe("X coordinate of the point on the wire"), x: z.number().describe("X coordinate of a wire endpoint or junction"),
y: z.number().describe("Y coordinate of the point on the wire"), y: z.number().describe("Y coordinate of a wire endpoint or junction"),
}, },
async (args: { schematicPath: string; x: number; y: number }) => { async (args: { schematicPath: string; x: number; y: number }) => {
const result = await callKicadScript("get_wire_connections", args); const result = await callKicadScript("get_wire_connections", args);