Skip to main content
Glama
geniuskey

klayout-draw-mcp

by geniuskey

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
new_layoutA

Start a new in-memory layout to draw into.

top_cell: name of the top cell. dbu: database unit in micrometers (0.001 = 1 nm grid). Resets any previous in-memory layout.

add_boxC

Add a rectangle (micrometers) on GDS layer/datatype.

add_polygonC

Add a polygon from a list of [x, y] vertices (micrometers).

add_pathC

Add a path: centerline [x, y] points (micrometers) with the given width.

add_labelC

Add a text label at (x, y) micrometers.

create_cellA

Create (or select) a cell and make it the active drawing target.

Subsequent add_box / add_polygon / add_via / add_wire / place_cell calls go into this cell. Use it to build a reusable library cell, then use_cell back to the top and place_cell to instance it. Returns to the top cell with use_cell(top).

use_cellB

Switch the active drawing cell to an existing cell (e.g. the top cell).

place_cellB

Place an instance (or nx*ny array) of cell into the active cell.

orient: r0/r90/r180/r270 (rotation) or m0/m90/... (mirror + rotation). For an array, dx/dy are the column/row pitches in micrometers. Coordinates in um.

add_viaA

Add a via (cut array + enclosing metal on both layers) centred at (x, y).

Builds a rows*cols array of cuts (cut_size, spaced by cut_space) on cut_layer and a metal landing on bottom_layer and top_layer extended by enclosure around the cut array. All dimensions in micrometers.

add_wireA

Add a Manhattan wire: routes through points inserting L-corners so every segment is axis-aligned. horizontal_first chooses the corner direction at each dog-leg. For layer changes, drop an add_via at the turn. Coordinates in um.

layout_infoA

Report the current layout: top cell, dbu, layers, bbox, shape count.

save_gdsA

Write the current layout to a file (.gds/.oas by extension). Optionally open it in the editor.

open_layoutB

Open an existing layout file in KLayout (viewer mode).

open_editorA

Open KLayout in editor mode (-e). With a file: edit it. Without: a blank layout to draw.

load_gdsA

Load an existing GDS/OASIS file into the active session for editing.

After loading, keep adding shapes (add_box / add_polygon / ...), inspect or DRC-check it, then save_gds() to write it back. top_cell selects the cell to edit (defaults to the first top cell). Replaces any current in-memory layout.

inspect_gdsA

Inspect a layout: per-layer shape count, area and bbox, plus the cell list.

With path: inspect that file without touching the session. Without it: inspect the current in-memory session. Areas use merged geometry (so overlaps are not double-counted); coordinates are in micrometers.

drc_checkA

Run simple DRC rules against a layout and report violations.

Operates on path if given, else the current session. Each rule is a dict (datatype defaults to 0, distances in micrometers):

{"type": "spacing", "layer": L, "datatype": D, "min": um} {"type": "width", "layer": L, "datatype": D, "min": um} {"type": "overlap", "layer": L, "datatype": D, "layer2": L2, "datatype2": D2} {"type": "separation", "layer": L, "datatype": D, "layer2": L2, "datatype2": D2, "min": um} {"type": "enclosure", "layer": L, "datatype": D, "layer2": L2, "datatype2": D2, "min": um}

"spacing" is min space within a layer; "width" is min feature width; "overlap" flags any intersection between two layers (forbidden overlap); "separation" is min space between two layers; "enclosure" requires layer2 to surround layer by min. Up to max_report violation centres are listed per rule.

run_scriptA

Execute Python with klayout.db available (advanced).

Injected names: db (klayout.db), klayout, session (current LayoutSession or None), LayoutSession. stdout is captured and returned. A script may rebind session to a new LayoutSession to make it the active layout. Runs locally in-process with full Python access.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/geniuskey/klayout-draw-mcp'

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