Skip to main content
Glama
NellyW8
by NellyW8

view_gds

Open and visualize GDSII files directly in KLayout viewer by specifying the project ID and optional GDS filename. Integrates with EDA Tools MCP Server for streamlined ASIC design workflows.

Instructions

Open GDSII file in KLayout viewer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gds_fileNoSpecific GDS filename (optional, auto-detected if not provided)
project_idYesProject ID from OpenLane run

Implementation Reference

  • Core handler function viewGds in EDAServer class. Locates GDS file (specified or auto-detects from latest OpenLane run), checks existence, launches KLayout viewer using 'open -a KLayout', returns JSON status.
    async viewGds(projectId: string, gdsFile?: string): Promise<string> { try { const project = this.projects.get(projectId); if (!project) { return JSON.stringify({ success: false, error: `Project ${projectId} not found.`, }, null, 2); } let gdsPath = ""; if (gdsFile) { // Specific GDS file provided gdsPath = join(project.dir, gdsFile); } else { // Auto-find GDS file in OpenLane project const runsDir = join(project.dir, "runs"); try { const runs = await fs.readdir(runsDir); if (runs.length > 0) { const latestRun = runs.sort().reverse()[0]; const finalDir = join(runsDir, latestRun, "final", "gds"); const gdsFiles = await fs.readdir(finalDir); const gdsFilesList = gdsFiles.filter(f => f.endsWith('.gds')); if (gdsFilesList.length > 0) { gdsPath = join(finalDir, gdsFilesList[0]); } } } catch { return JSON.stringify({ success: false, error: "No GDS files found in project. Run OpenLane flow first.", }, null, 2); } } if (!gdsPath) { return JSON.stringify({ success: false, error: "No GDS file found to open.", }, null, 2); } // Check if GDS file exists try { await fs.access(gdsPath); } catch { return JSON.stringify({ success: false, error: `GDS file not found: ${gdsPath}`, }, null, 2); } // Launch KLayout directly with the correct command format const klayoutCmd = `open -a KLayout "${gdsPath}"`; await execAsyncWithTimeout(klayoutCmd, { shell: true }, 10000); return JSON.stringify({ success: true, message: `KLayout launched with GDS file`, gds_file: basename(gdsPath), gds_path: gdsPath, project_id: projectId, command_executed: klayoutCmd }, null, 2); } catch (error: any) { return JSON.stringify({ success: false, error: error.message || String(error), }, null, 2); } }
  • src/index.ts:820-836 (registration)
    MCP tool registration in ListToolsRequestHandler response. Defines name, description, and input schema (project_id required, gds_file optional).
    name: "view_gds", description: "Open GDSII file in KLayout viewer", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "Project ID from OpenLane run" }, gds_file: { type: "string", description: "Specific GDS filename (optional, auto-detected if not provided)" }, }, required: ["project_id"], }, },
  • Input schema definition for view_gds tool: requires project_id (string), optional gds_file (string).
    inputSchema: { type: "object", properties: { project_id: { type: "string", description: "Project ID from OpenLane run" }, gds_file: { type: "string", description: "Specific GDS filename (optional, auto-detected if not provided)" }, }, required: ["project_id"], },
  • Dispatch handler in CallToolRequestHandler switch statement. Validates arguments and calls the viewGds method on edaServer instance.
    case "view_gds": { const projectId = validateRequiredString(args, "project_id", name); const gdsFile = getStringProperty(args, "gds_file", ""); return { content: [{ type: "text", text: await edaServer.viewGds(projectId, gdsFile || undefined), }], }; }

Other Tools

Related 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/MCP4EDA'

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