feat: add export_sch_python_bom tool (kicad-cli, legacy Python-BOM XML)

New MCP tool `export_sch_python_bom` wrapping `kicad-cli sch export
python-bom`: emits the legacy intermediate XML netlist consumed by the
schematic editor's Python BOM scripts. Minimal option set (outputPath +
schematicPath only, matching the subcommand's --help). schematicPath
required and validated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gavin Colonese
2026-06-12 11:00:57 -04:00
parent 91477e8d02
commit d48f4835b0
3 changed files with 79 additions and 0 deletions

View File

@@ -1318,5 +1318,29 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
},
);
// ------------------------------------------------------
// Export Schematic Python-BOM Tool (kicad-cli)
// ------------------------------------------------------
server.tool(
"export_sch_python_bom",
"Export the legacy Python-BOM intermediate XML from a schematic via kicad-cli (`sch export python-bom`). This is the XML netlist consumed by the schematic editor's Python BOM scripts. Minimal option set (output + input only). schematicPath is REQUIRED.",
{
schematicPath: z.string().describe("Path to the .kicad_sch (required)"),
outputPath: z.string().describe("Output XML file path"),
},
async (args) => {
logger.debug(`Exporting schematic Python-BOM to: ${args.outputPath}`);
const result = await callKicadScript("export_sch_python_bom", args);
return {
content: [
{
type: "text",
text: JSON.stringify(result),
},
],
};
},
);
logger.info("Export tools registered");
}

View File

@@ -76,6 +76,7 @@ export const toolCategories: ToolCategory[] = [
"export_sch_dxf",
"export_sch_hpgl",
"export_sch_ps",
"export_sch_python_bom",
"export_pdf",
"export_svg",
"export_3d",