validate_project
Validate KiCad electronic design projects to check for errors and ensure proper functionality before manufacturing.
Instructions
Basic validation of a KiCad project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes |
Implementation Reference
- kicad_mcp/tools/analysis_tools.py:18-49 (handler)The core handler function for the 'validate_project' tool. It validates a KiCad project by checking if the path exists, essential files (PCB and schematic) are present, and the project file is valid JSON.@mcp.tool() def validate_project(project_path: str) -> Dict[str, Any]: """Basic validation of a KiCad project.""" if not os.path.exists(project_path): return {"valid": False, "error": f"Project not found: {project_path}"} issues = [] files = get_project_files(project_path) # Check for essential files if "pcb" not in files: issues.append("Missing PCB layout file") if "schematic" not in files: issues.append("Missing schematic file") # Validate project file try: with open(project_path, 'r') as f: import json json.load(f) except json.JSONDecodeError: issues.append("Invalid project file format (JSON parsing error)") except Exception as e: issues.append(f"Error reading project file: {str(e)}") return { "valid": len(issues) == 0, "path": project_path, "issues": issues if issues else None, "files_found": list(files.keys()) }
- kicad_mcp/tools/analysis_tools.py:11-17 (registration)The registration function that defines and decorates the validate_project tool using @mcp.tool().def register_analysis_tools(mcp: FastMCP) -> None: """Register analysis and validation tools with the MCP server. Args: mcp: The FastMCP server instance """
- kicad_mcp/server.py:147-155 (registration)Top-level registration block in the server creation where register_analysis_tools(mcp) is called to register the validate_project tool among others.# Register tools logging.info(f"Registering tools...") register_project_tools(mcp) register_analysis_tools(mcp) register_export_tools(mcp) register_drc_tools(mcp) register_bom_tools(mcp) register_netlist_tools(mcp) register_pattern_tools(mcp)
- kicad_mcp/server.py:23-23 (registration)Import of the register_analysis_tools function used to register the validate_project tool.from kicad_mcp.tools.analysis_tools import register_analysis_tools