open_project
Open a KiCad project to access and work with electronic design files for PCB development and analysis.
Instructions
Open a KiCad project in KiCad.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes |
Implementation Reference
- kicad_mcp/tools/project_tools.py:56-60 (handler)The handler function for the 'open_project' tool, decorated with @mcp.tool() and delegating to the helper function open_kicad_project.@mcp.tool() def open_project(project_path: str) -> Dict[str, Any]: """Open a KiCad project in KiCad.""" return open_kicad_project(project_path)
- kicad_mcp/server.py:149-149 (registration)Top-level registration call in the main server creation that registers all project tools, including 'open_project', via register_project_tools.register_project_tools(mcp)
- Supporting utility function that executes the subprocess command to open the KiCad project in the appropriate application based on the operating system.def open_kicad_project(project_path: str) -> Dict[str, Any]: """Open a KiCad project using the KiCad application. Args: project_path: Path to the .kicad_pro file Returns: Dictionary with result information """ if not os.path.exists(project_path): return {"success": False, "error": f"Project not found: {project_path}"} try: cmd = [] if sys.platform == "darwin": # macOS # On MacOS, use the 'open' command to open the project in KiCad cmd = ["open", "-a", config.KICAD_APP_PATH, project_path] elif sys.platform == "linux": # Linux # On Linux, use 'xdg-open' cmd = ["xdg-open", project_path] else: # Fallback or error for unsupported OS return {"success": False, "error": f"Unsupported operating system: {sys.platform}"} result = subprocess.run(cmd, capture_output=True, text=True) return { "success": result.returncode == 0, "command": " ".join(cmd), "output": result.stdout, "error": result.stderr if result.returncode != 0 else None } except Exception as e: return {"success": False, "error": str(e)}