Skip to main content
Glama
NellyW8

EDA Tools MCP Server

by NellyW8

run_openlane

Execute complete ASIC design flow from RTL to GDSII using OpenLane for chip implementation.

Instructions

Run complete ASIC design flow using OpenLane (RTL to GDSII). This process can take up to 10 minutes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verilog_codeYesThe Verilog RTL code for ASIC implementation
design_nameYesName of the design (will be used for module and files)
clock_portNoName of the clock portclk
clock_periodNoClock period in nanoseconds
open_in_klayoutNoAutomatically open result in KLayout

Implementation Reference

  • The core handler function `runOpenlane` in the `EDAServer` class. It creates a temporary OpenLane project directory, writes the provided Verilog code and configuration (including clock port and period), generates a wrapper bash script to run OpenLane via Docker, executes it with timeout handling, locates the generated GDS file, and optionally launches KLayout to view it. Returns JSON with project details, paths, stdout/stderr (truncated), and status.
      async runOpenlane(
        verilogCode: string, 
        designName: string, 
        clockPort = "clk", 
        clockPeriod = 10.0,
        openInKlayout = true
      ): Promise<string> {
        try {
          const projectId = Math.random().toString(36).substring(2, 15);
          const projectName = `${designName}_${projectId}`;
          const projectDir = join(this.openlaneDir, projectName);
          
          // Store project info
          this.projects.set(projectId, { dir: projectDir, type: "openlane" });
    
          // Create project directory
          await fs.mkdir(projectDir, { recursive: true });
    
          // Write Verilog file
          const verilogFile = join(projectDir, `${designName}.v`);
          await fs.writeFile(verilogFile, verilogCode);
    
          // Create OpenLane config
          const configContent = {
            DESIGN_NAME: designName,
            VERILOG_FILES: [`${designName}.v`],
            CLOCK_PORT: clockPort,
            CLOCK_PERIOD: clockPeriod,
            // Additional OpenLane settings for better results
            FP_SIZING: "absolute",
            DIE_AREA: "0 0 100 100",
            FP_PDN_MULTILAYER: false,
            QUIT_ON_TIMING_VIOLATIONS: false,
            QUIT_ON_MAGIC_DRC: false,
            QUIT_ON_LVS_ERROR: false,
            RUN_KLAYOUT_XOR: false,
            RUN_KLAYOUT_DRC: false
          };
    
          const configFile = join(projectDir, "config.json");
          await fs.writeFile(configFile, JSON.stringify(configContent, null, 2));
    
          // Find Python command
          let pythonCmd = "python3";
          const pythonCandidates = [
            "python3",
            "python"
          ];
          
          for (const candidate of pythonCandidates) {
            if (await commandExists(candidate)) {
              pythonCmd = candidate;
              break;
            }
          }
    
          // Run the OpenLane command using Docker MCP approach
          console.error(`Starting OpenLane flow for ${designName}...`);
          console.error(`Working directory: ${projectDir}`);
          console.error(`This may take up to 10 minutes...`);
    
          const openlaneCmd = `${pythonCmd} -m openlane --dockerized config.json`;
          console.error(`Executing: ${openlaneCmd}`);
    
          // Create a wrapper script to handle TTY issues
          const wrapperScript = `#!/bin/bash
    set -e
    
    # Disable TTY requirements
    export DEBIAN_FRONTEND=noninteractive
    export CI=true
    export TERM=dumb
    
    # Change to project directory
    cd "${projectDir}"
    
    # Run OpenLane with script command to simulate TTY
    script -q /dev/null ${pythonCmd} -m openlane --dockerized config.json
    `;
    
          const wrapperPath = join(projectDir, 'run_openlane.sh');
          await fs.writeFile(wrapperPath, wrapperScript);
          await execAsyncWithTimeout(`chmod +x "${wrapperPath}"`, {});
    
          // Run the OpenLane command using the wrapper script
          console.error(`Starting OpenLane flow for ${designName}...`);
          console.error(`Working directory: ${projectDir}`);
          console.error(`This may take up to 10 minutes...`);
          console.error(`Using wrapper script to handle TTY`);
    
          const { stdout, stderr } = await execAsyncWithTimeout(`"${wrapperPath}"`, {
            cwd: projectDir,
            env: {
              ...process.env,
              PATH: process.env.PATH + ":/usr/local/bin:/opt/homebrew/bin"
            },
            maxBuffer: 10 * 1024 * 1024, // 10MB buffer instead of default 1MB
            timeout: 600000
          }, 600000); // 10 minutes timeout
    
          // Find the latest run directory
          const runsDir = join(projectDir, "runs");
          let latestRun = "";
          let gdsFile = "";
          
          try {
            const runs = await fs.readdir(runsDir);
            if (runs.length > 0) {
              // Sort runs by name (they include timestamps) and get the latest
              latestRun = runs.sort().reverse()[0];
              const finalDir = join(runsDir, latestRun, "final", "gds");
              
              // Find GDS file
              try {
                const gdsFiles = await fs.readdir(finalDir);
                const gdsFilesList = gdsFiles.filter(f => f.endsWith('.gds'));
                if (gdsFilesList.length > 0) {
                  gdsFile = join(finalDir, gdsFilesList[0]);
                }
              } catch {
                // GDS directory might not exist
              }
            }
          } catch {
            // Runs directory might not exist
          }
    
          let klayoutResult = "";
          
          // Open in KLayout if requested and GDS file exists
          if (openInKlayout && gdsFile) {
            try {
              // Check if KLayout is available
              if (await commandExists('klayout')) {
                // Launch KLayout with the GDS file
                const klayoutCmd = `open -a KLayout "${gdsFile}" &`;
                await execAsyncWithTimeout(klayoutCmd, {}, 10000);
                klayoutResult = `KLayout launched with GDS file: ${basename(gdsFile)}`;
              } else {
                klayoutResult = "KLayout not found. Install KLayout to view GDS files.";
              }
            } catch (error: any) {
              klayoutResult = `KLayout launch failed: ${error.message}`;
            }
          }
    
          return JSON.stringify({
            project_id: projectId,
            success: true,
            design_name: designName,
            project_dir: projectDir,
            latest_run: latestRun,
            gds_file: gdsFile ? basename(gdsFile) : "Not generated",
            gds_path: gdsFile,
            klayout_status: klayoutResult,
            command_used: openlaneCmd,
            stdout: stdout.length > 2000 ? stdout.substring(0, 2000) + "...(truncated)" : stdout,
            stderr: stderr.length > 2000 ? stderr.substring(0, 2000) + "...(truncated)" : stderr,
            note: "OpenLane flow completed. Check the runs directory for detailed results."
          }, null, 2);
    
        } catch (error: any) {
          // Simple error reporting
          const errorMessage = error.message || String(error);
          console.error(`OpenLane error: ${errorMessage}`);
          
          return JSON.stringify({
            success: false,
            error: errorMessage,
            note: "OpenLane flow failed. Make sure Docker is running and try: docker pull efabless/openlane:latest"
          }, null, 2);
        }
      }
  • The input schema definition for the `run_openlane` tool, specifying required parameters (verilog_code, design_name) and optional ones (clock_port, clock_period, open_in_klayout). Used for validation in MCP tool calls.
    inputSchema: {
      type: "object",
      properties: {
        verilog_code: { 
          type: "string", 
          description: "The Verilog RTL code for ASIC implementation" 
        },
        design_name: { 
          type: "string", 
          description: "Name of the design (will be used for module and files)" 
        },
        clock_port: { 
          type: "string", 
          description: "Name of the clock port", 
          default: "clk" 
        },
        clock_period: { 
          type: "number", 
          description: "Clock period in nanoseconds", 
          default: 10.0 
        },
        open_in_klayout: {
          type: "boolean",
          description: "Automatically open result in KLayout",
          default: true
        },
      },
      required: ["verilog_code", "design_name"],
    },
  • src/index.ts:786-818 (registration)
    Registration of the `run_openlane` tool in the MCP server's `ListToolsRequestSchema` handler. Includes name, description, and references the inputSchema. This makes the tool discoverable by MCP clients.
    {
      name: "run_openlane",
      description: "Run complete ASIC design flow using OpenLane (RTL to GDSII). This process can take up to 10 minutes.",
      inputSchema: {
        type: "object",
        properties: {
          verilog_code: { 
            type: "string", 
            description: "The Verilog RTL code for ASIC implementation" 
          },
          design_name: { 
            type: "string", 
            description: "Name of the design (will be used for module and files)" 
          },
          clock_port: { 
            type: "string", 
            description: "Name of the clock port", 
            default: "clk" 
          },
          clock_period: { 
            type: "number", 
            description: "Clock period in nanoseconds", 
            default: 10.0 
          },
          open_in_klayout: {
            type: "boolean",
            description: "Automatically open result in KLayout",
            default: true
          },
        },
        required: ["verilog_code", "design_name"],
      },
    },
  • The switch case dispatcher in `CallToolRequestSchema` handler that validates parameters and invokes `edaServer.runOpenlane()` with extracted arguments (verilogCode, designName, etc.). Returns the result as MCP content.
    case "run_openlane": {
      const verilogCode = validateRequiredString(args, "verilog_code", name);
      const designName = validateRequiredString(args, "design_name", name);
      const clockPort = getStringProperty(args, "clock_port", "clk");
      const clockPeriod = getNumberProperty(args, "clock_period", 10.0);
      const openInKlayout = args && args.open_in_klayout !== false; // Default true
      
      return {
        content: [{
          type: "text",
          text: await edaServer.runOpenlane(verilogCode, designName, clockPort, clockPeriod, openInKlayout),
        }],
      };
    }
Behavior3/5

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

With no annotations, the description carries full burden. It discloses the critical time constraint ('can take up to 10 minutes'), which is valuable behavioral context. However, it doesn't mention other traits like error handling, resource requirements, or output format, leaving significant gaps for a complex execution tool.

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?

Two sentences with zero waste: the first states purpose and scope, the second adds crucial behavioral context (time constraint). Every element earns its place, and information is front-loaded appropriately.

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?

For a complex 5-parameter tool with no annotations and no output schema, the description is incomplete. It covers purpose and time constraint but lacks information about what happens after execution, error conditions, or relationship to sibling tools like 'view_gds' for results.

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?

Schema description coverage is 100%, providing full parameter documentation. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline for high coverage without compensating value.

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

Purpose5/5

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

The description clearly states the specific action ('Run complete ASIC design flow') and resource ('using OpenLane'), with precise scope ('RTL to GDSII'). It effectively distinguishes from siblings like 'synthesize_verilog' (partial flow) and 'read_openlane_reports' (analysis only).

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

Usage Guidelines3/5

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

The description implies usage for full ASIC implementation from RTL, but doesn't explicitly state when to choose this over alternatives like 'synthesize_verilog' for partial flow or 'simulate_verilog' for verification. No guidance on prerequisites or exclusions is provided.

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/NellyW8/mcp-EDA'

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