diff --git a/python/commands/routing.py b/python/commands/routing.py index b84f4c1..563314d 100644 --- a/python/commands/routing.py +++ b/python/commands/routing.py @@ -1095,11 +1095,25 @@ class RoutingCommands: y1 = board_box.GetY() / scale x2 = (board_box.GetX() + board_box.GetWidth()) / scale y2 = (board_box.GetY() + board_box.GetHeight()) / scale + + # Detect corner radius from Edge.Cuts arcs so the zone rectangle + # stays inside the rounded board corners (avoids zone visually + # extending outside Edge.Cuts before refill) + corner_radius = 0.0 + edge_layer_id = self.board.GetLayerID("Edge.Cuts") + for item in self.board.GetDrawings(): + if item.GetLayer() == edge_layer_id and item.GetClass() == "PCB_ARC": + r = item.GetRadius() / scale + if r > corner_radius: + corner_radius = r + # Inset the zone rectangle by the corner radius so its corners + # lie on the straight portions of the board edge. + inset = corner_radius points = [ - {"x": x1, "y": y1}, - {"x": x2, "y": y1}, - {"x": x2, "y": y2}, - {"x": x1, "y": y2}, + {"x": x1 + inset, "y": y1 + inset}, + {"x": x2 - inset, "y": y1 + inset}, + {"x": x2 - inset, "y": y2 - inset}, + {"x": x1 + inset, "y": y2 - inset}, ] else: return { diff --git a/src/tools/registry.ts b/src/tools/registry.ts index 6eec4fb..ddb307e 100644 --- a/src/tools/registry.ts +++ b/src/tools/registry.ts @@ -228,16 +228,24 @@ export function searchTools(query: string): SearchResult[] { const q = query.toLowerCase(); const matches: SearchResult[] = []; - // This is a placeholder - we'll populate descriptions from actual tool definitions - // For now, we'll search by name and category + // Search direct tools first + for (const toolName of directToolNames) { + if (toolName.toLowerCase().includes(q)) { + matches.push({ + category: "direct", + tool: toolName, + description: `${toolName} (direct tool — call directly, no execute_tool needed)` + }); + } + } + + // Search routed tools by name and category for (const category of toolCategories) { - // Check if category name or description matches const categoryMatch = category.name.toLowerCase().includes(q) || category.description.toLowerCase().includes(q); for (const toolName of category.tools) { - // Check if tool name matches or category matches if (toolName.toLowerCase().includes(q) || categoryMatch) { matches.push({ category: category.name,