diff --git a/python/commands/wire_connectivity.py b/python/commands/wire_connectivity.py index 5942c6a..b7a1c41 100644 --- a/python/commands/wire_connectivity.py +++ b/python/commands/wire_connectivity.py @@ -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]: """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: - "pins": list of {"component": str, "pin": str} - "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) if not all_wires: diff --git a/src/tools/schematic.ts b/src/tools/schematic.ts index 594be86..55aff42 100644 --- a/src/tools/schematic.ts +++ b/src/tools/schematic.ts @@ -428,11 +428,11 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp // Get wire connections server.tool( "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"), - x: z.number().describe("X coordinate of the point on the wire"), - y: z.number().describe("Y 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 a wire endpoint or junction"), }, async (args: { schematicPath: string; x: number; y: number }) => { const result = await callKicadScript("get_wire_connections", args);