feat: add export_odb tool (kicad-cli, ODB++ archive)
New MCP tool `export_odb` wrapping `kicad-cli pcb export odb`: precision, compression mode (zip/tgz/none), and units. Single ODB++ job archive for CAM/MES/assembly. Self-contained interface handler reading the saved .kicad_pcb. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -499,5 +499,40 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
},
|
||||
);
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Export ODB++ Tool (kicad-cli)
|
||||
// ------------------------------------------------------
|
||||
server.tool(
|
||||
"export_odb",
|
||||
"Export the PCB in ODB++ format via kicad-cli. Single job archive (copper, drill, placement, components, nets, outline) widely used by CAM/MES/assembly. Reads the last SAVED state of the .kicad_pcb.",
|
||||
{
|
||||
outputPath: z.string().describe("Output file path (archive or directory per compression)"),
|
||||
boardPath: z.string().optional().describe("Path to the .kicad_pcb (default: current board)"),
|
||||
drawingSheet: z.string().optional().describe("Path to a drawing sheet override"),
|
||||
defineVar: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.describe("Project variable overrides as 'KEY=VALUE' strings"),
|
||||
precision: z.number().optional().describe("Coordinate precision (default 2)"),
|
||||
compression: z
|
||||
.enum(["zip", "tgz", "none"])
|
||||
.optional()
|
||||
.describe("Output container/compression mode (default zip)"),
|
||||
units: z.enum(["mm", "in"]).optional().describe("Units (default mm)"),
|
||||
},
|
||||
async (args) => {
|
||||
logger.debug(`Exporting ODB++ to: ${args.outputPath}`);
|
||||
const result = await callKicadScript("export_odb", args);
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: JSON.stringify(result),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
logger.info("Export tools registered");
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ export const toolCategories: ToolCategory[] = [
|
||||
"export_gerbers",
|
||||
"export_drill",
|
||||
"export_ipc2581",
|
||||
"export_odb",
|
||||
"export_pdf",
|
||||
"export_svg",
|
||||
"export_3d",
|
||||
|
||||
Reference in New Issue
Block a user