extract_project_netlist
Extract netlist information from KiCad schematic files to analyze circuit connections and component relationships in electronic design projects.
Instructions
Extract netlist from a KiCad project's schematic.
This tool finds the schematic associated with a KiCad project and extracts its netlist information.
Args: project_path: Path to the KiCad project file (.kicad_pro) ctx: MCP context for progress reporting
Returns: Dictionary with netlist information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| ctx | Yes |
Implementation Reference
- kicad_mcp/tools/netlist_tools.py:97-155 (handler)The handler function decorated with @mcp.tool() that implements the extract_project_netlist tool. It finds the schematic in the project, extracts the netlist using extract_schematic_netlist, and returns the results.@mcp.tool() async def extract_project_netlist(project_path: str, ctx: Context | None) -> Dict[str, Any]: """Extract netlist from a KiCad project's schematic. This tool finds the schematic associated with a KiCad project and extracts its netlist information. Args: project_path: Path to the KiCad project file (.kicad_pro) ctx: MCP context for progress reporting Returns: Dictionary with netlist information """ print(f"Extracting netlist for project: {project_path}") if not os.path.exists(project_path): print(f"Project not found: {project_path}") if ctx: ctx.info(f"Project not found: {project_path}") return {"success": False, "error": f"Project not found: {project_path}"} # Report progress if ctx: await ctx.report_progress(10, 100) # Get the schematic file try: files = get_project_files(project_path) if "schematic" not in files: print("Schematic file not found in project") if ctx: ctx.info("Schematic file not found in project") return {"success": False, "error": "Schematic file not found in project"} schematic_path = files["schematic"] print(f"Found schematic file: {schematic_path}") if ctx: ctx.info(f"Found schematic file: {os.path.basename(schematic_path)}") # Extract netlist if ctx: await ctx.report_progress(20, 100) # Call the schematic netlist extraction result = await extract_schematic_netlist(schematic_path, ctx) # Add project path to result if "success" in result and result["success"]: result["project_path"] = project_path return result except Exception as e: print(f"Error extracting project netlist: {str(e)}") if ctx: ctx.info(f"Error extracting project netlist: {str(e)}") return {"success": False, "error": str(e)}
- kicad_mcp/server.py:154-154 (registration)The call to register_netlist_tools(mcp) in the server creation, which registers all netlist tools including extract_project_netlist.register_netlist_tools(mcp)