Skip to main content
Glama
lamaalrajih

KiCad MCP Server

by lamaalrajih

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
NameRequiredDescriptionDefault
project_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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())
        }
  • 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
        """
  • 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)
  • Import of the register_analysis_tools function used to register the validate_project tool.
    from kicad_mcp.tools.analysis_tools import register_analysis_tools
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'basic validation' but doesn't clarify what that involves (e.g., syntax checks, file integrity, error reporting), whether it's read-only or has side effects, or any performance considerations. This leaves key behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, avoiding redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 1 parameter, no annotations, and an output schema (which handles return values), the description is minimally complete. It states the tool's purpose but lacks details on validation scope, behavioral traits, and usage context, making it adequate but with clear gaps for informed tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It implies validation of a 'KiCad project' via 'project_path,' adding minimal context about the parameter's purpose. However, it doesn't detail path format, constraints, or examples, resulting in baseline adequacy without full compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool performs 'basic validation of a KiCad project,' which provides a clear verb ('validate') and resource ('KiCad project'). However, it's vague about what 'basic validation' entails compared to siblings like 'run_drc_check' or 'analyze_project_circuit_patterns,' lacking specific differentiation in scope or depth.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives. With siblings like 'run_drc_check' (likely more detailed checks) and 'analyze_project_circuit_patterns' (pattern analysis), it fails to specify scenarios, prerequisites, or exclusions, leaving usage ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lamaalrajih/kicad-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server