klayout-mcp
Read-only MCP server that lets you inspect, measure, render, and DRC-check KLayout GDS/OAS layouts.
Sessions:
open_layout(GDS/OAS path, optional format/top cell) andclose_sessionStructure:
list_layers,list_cells(withmax_depth),describe_cell(hierarchy depth)Geometry queries:
query_region(box/cell/layers with hierarchy mode, shape and instance limits),measure_geometry(modes over target IDs),analyze_waveguide(target ID)Viewing:
set_view(box/cell/layers) andrender_view(deterministic PNG with style, image size, annotations)DRC:
run_drc_script(Ruby/Python scripts, params) andextract_markers(marker crops, run ID)Outputs: structured JSON results with absolute artifact paths (renders, DRC reports, marker crops, logs); errors return codes like
FILE_NOT_FOUND,INVALID_BOX,DRC_RUN_FAILEDSetup: stdio server launched via
uvx klayout-mcp@latest(or installed tool), withKLAYOUT_BINneeded for batch DRC
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@klayout-mcpopen 'chip.gds' and list all layers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
klayout-mcp
Read-only MCP server for KLayout. It opens GDS/OAS layouts, inspects geometry and hierarchy, renders deterministic PNGs, and runs batch DRC with structured JSON output.
Install
Fastest one-off run:
uvx klayout-mcp@latestInstall once:
uv tool install klayout-mcpTraditional Python install:
python -m pip install klayout-mcpFor batch DRC, the klayout executable must be on PATH or exposed through KLAYOUT_BIN.
export KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayoutRelated MCP server: mcp-kicad
Quick Start
klayout-mcp is a stdio MCP server. The default launch shape is:
command: uvx
args: klayout-mcp@latestIf your client cannot use uvx, install the tool once and launch klayout-mcp directly.
Typical workflow:
open_layoutlist_layerslist_cellsordescribe_cellquery_regionmeasure_geometryanalyze_waveguiderender_viewrun_drc_scriptextract_markersclose_session
Client Setup
More copy-paste examples live in examples/mcp/README.md.
Codex
[mcp_servers.klayout]
command = "uvx"
args = ["klayout-mcp@latest"]
[mcp_servers.klayout.env]
KLAYOUT_BIN = "/Applications/klayout.app/Contents/MacOS/klayout"Or add it with the CLI:
codex mcp add klayout \
--env KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayout \
-- uvx klayout-mcp@latestClaude Code
{
"mcpServers": {
"klayout": {
"command": "uvx",
"args": ["klayout-mcp@latest"],
"env": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}Or add it with the CLI:
claude mcp add --transport stdio klayout \
--scope project \
--env KLAYOUT_BIN=/Applications/klayout.app/Contents/MacOS/klayout \
-- uvx klayout-mcp@latestCursor
Cursor is file-config based:
{
"mcpServers": {
"klayout": {
"command": "uvx",
"args": ["klayout-mcp@latest"],
"env": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}OpenCode
OpenCode is file-config based:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"klayout": {
"type": "local",
"command": ["uvx", "klayout-mcp@latest"],
"enabled": true,
"environment": {
"KLAYOUT_BIN": "/Applications/klayout.app/Contents/MacOS/klayout"
}
}
}
}Other MCP Hosts
Use:
command:uvxargs:["klayout-mcp@latest"]env:KLAYOUT_BINwhen needed
Tools
Session:
open_layout,close_sessionStructure:
list_layers,list_cells,describe_cellGeometry:
query_region,measure_geometry,analyze_waveguideView:
set_view,render_viewDRC:
run_drc_script,extract_markers
Configuration
Variable | Purpose | Default |
| Root directory for runtime artifacts |
|
| Session inactivity timeout |
|
| KLayout batch executable for DRC |
|
Behavior:
any absolute local path can be used for layouts and DRC scripts
artifact paths returned by tools are absolute
sessions expire lazily after inactivity
close_sessionremoves the session artifact directory
Default artifact location:
source checkout (
uv run klayout-mcpin this repository):<repo>/.artifactsinstalled package (
uvx,uv tool install,pip): the per-user cache directoryLinux:
$XDG_CACHE_HOME/klayout-mcp(default~/.cache/klayout-mcp)macOS:
~/Library/Caches/klayout-mcpWindows:
%LOCALAPPDATA%\klayout-mcp\Cache
a relative
KLAYOUT_MCP_ARTIFACT_ROOTresolves against the repository root in a checkout, or the server's working directory otherwise
Artifacts And Errors
Artifacts are stored under <artifact root>/sessions/<session_id>/ and include renders, DRC reports, marker crops, and logs.
Tool failures return structured JSON such as:
{
"code": "FILE_NOT_FOUND",
"message": "Layout file does not exist",
"details": {
"path": "/abs/path/to/missing.gds"
}
}Common codes: FILE_NOT_FOUND, SESSION_NOT_FOUND, INVALID_BOX, INVALID_LAYER, INVALID_TARGET, DRC_RUN_FAILED.
Development
For a source checkout:
uv sync --extra dev
uv run klayout-mcpIf an MCP client needs to launch the checkout directly:
command: uv
args: --directory /abs/path/to/klayout-mcp run klayout-mcpContributor workflow is in CONTRIBUTING.md. Release notes are in CHANGELOG.md.
Releases
Normal releases are automated with release-please.
merge Conventional Commits to
mainrelease-pleaseopens or updates a release PRmerging that release PR updates
pyproject.toml,CHANGELOG.md, creates the tag and GitHub release, and publishes to PyPI
To let the release PR run normal CI under branch protection, configure a repository secret named RELEASE_PLEASE_TOKEN with a GitHub token that can open pull requests. Without it, release-please falls back to github.token, which may not trigger PR workflows.
The manual release.yml workflow remains available for TestPyPI validation and recovery publishing.
Reference
Documentation Site
The repository is configured for Read the Docs with MkDocs.
Build the docs locally:
uv run --extra docs mkdocs build --strictServe the docs locally:
uv run --extra docs mkdocs serveAfter importing the GitHub repository into Read the Docs, it can build directly from the default branch using .readthedocs.yaml.
Available Tools
12 toolsanalyze_waveguideA
Analyze a path shape as a waveguide: width, length, orientation, and bend estimate.
Args:
session_id: Session returned by open_layout.
target_id: Id of a path shape returned by query_region.
| Name | Required | Description | Default |
|---|---|---|---|
| target_id | Yes | ||
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are supplied, so the description bears the full behavioral burden. It discloses the input provenance and the analyzed attributes, but says nothing about whether this is read-only, what happens with a non-path target, or any failure/precondition behavior. With an output schema present, the return-shape gap is covered, but the safety/edge-case gap is not.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences plus a compact two-item arg list, with the purpose front-loaded before the argument notes. Every element earns its place; only the lack of any note on non-path input keeps it from being exemplary.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter analysis tool with an output schema, the description covers purpose, both inputs, and their provenance, which is nearly the full picture. The remaining gap is behavioral (read-only status, path-type precondition) rather than functional.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate and largely does: it explains that session_id is the session returned by open_layout and target_id is the id of a path shape returned by query_region. That origin/type constraint is real added meaning beyond the bare string types in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Analyze a path shape as a waveguide') and enumerates the derived quantities (width, length, orientation, bend estimate), so the agent knows exactly what it produces. It does not explicitly contrast itself with the nearby sibling measure_geometry, so it falls short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The arg notes embed a workflow: session_id comes from open_layout and target_id must be a path shape from query_region, which implies the prerequisite call sequence and the accepted target type. There is no explicit statement of when to prefer this over measure_geometry or what to do if the target is not a path.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
close_sessionB
Close a session and delete its artifact directory (renders, DRC output).
Args:
session_id: Session returned by open_layout.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It does disclose the key destructive trait (the artifact directory, renders and DRC output, are deleted), which is genuinely useful. However it omits irreversibility, whether the session id becomes invalid, and behavior when the session is unknown or already closed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences plus an Args block, with the destructive side effect front-loaded right after the verb. No filler, nothing repeated for padding.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be described. Still, this is a destructive, unannotated, one-shot operation and the description leaves open whether closing is reversible, idempotent, or whether the session id remains usable — gaps that matter for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does so by explaining the provenance of `session_id` ('Session returned by `open_layout`'), which tells the agent where a valid value comes from rather than merely restating the type.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Close a session') and immediately qualifies it with the side effect ('delete its artifact directory (renders, DRC output)'), which is more than a tautology. It is clearly the inverse of the sibling `open_layout`, though that differentiation is only implied by the parameter note rather than stated.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description never says when to call this versus leaving a session open, nor does it warn that closing is presumably terminal for that session. Usage is only inferable from the verb itself; no conditions, prerequisites, or alternatives are named.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_cellA
Describe one cell: bounding box, child instances, text labels, and shapes per layer.
Args:
session_id: Session returned by open_layout.
cell: Name of the cell to describe.
depth: How many levels of child instances to expand (0 = none).
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | ||
| depth | No | ||
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the full behavioral burden. It does disclose the returned content and the depth expansion behavior, which is useful, but says nothing about permissions, whether it mutates session state, cost limits, or error conditions for an unannotated tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose is front-loaded in a single sentence, followed by a compact Args block that maps one-to-one to parameters. No filler or redundant restatement.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be detailed (though it summarizes them anyway), and all parameters are explained. The remaining gap is the absence of usage routing against siblings, which is minor given the low-complexity, read-oriented nature of the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does: it documents all three parameters, including the meaning of depth (levels to expand, 0 = none) and the origin of session_id (returned by open_layout). This adds real meaning beyond the bare schema titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource ('Describe one cell') and enumerates the outputs (bounding box, child instances, text labels, shapes per layer). This distinguishes it from sibling list_cells, though it never explicitly names that sibling to route the agent.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It implies a prerequisite by noting session_id comes from open_layout, giving a basic workflow hint. However, it offers no explicit when-to-use/when-not guidance versus list_cells, query_region, or measure_geometry, leaving selection largely to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
extract_markersA
Return the violation markers from a run_drc_script run.
Args:
session_id: Session returned by open_layout.
run_id: Run id returned by run_drc_script.
include_crops: Also render a PNG crop around each marker.
crop_size_um: Crop window size in microns: {"x": float, "y": float}
(default 20x20).
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | Yes | ||
| session_id | Yes | ||
| crop_size_um | No | ||
| include_crops | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It does disclose the optional side effect that `include_crops` renders a PNG crop and gives the default crop window (20x20 um), which is real behavioral context beyond the schema. It does not state read-only/safety profile, permission requirements, or behavior on an unknown run_id.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The purpose sentence is front-loaded and the parameter notes are terse and each earn their place. The Args block is slightly formulaic but contains no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists so return-value description is unnecessary, and the description covers purpose, all parameters, and the optional crop rendering. It would be fully complete with a note on what happens when the referenced run is missing or whether extraction is read-only.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does: it documents all four parameters, gives the provenance of session_id (`open_layout`) and run_id (`run_drc_script`), and clarifies crop_size_um as an {x, y} micron window with a default. Only the exact units/format edge cases are left thin.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Return the violation markers') and scopes it to a run produced by the sibling `run_drc_script`. An agent can distinguish this from query_region, measure_geometry, or run_drc_script itself without opening any schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'from a `run_drc_script` run' implies the prerequisite that a DRC run must exist and that run_id/session_id come from `open_layout` and `run_drc_script`, which is useful. However, there is no explicit when-to-use/when-not guidance or named alternative among the many siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_cellsA
List cells in the layout hierarchy, sorted by name.
Each entry has the cell bounding box in microns, whether it is a top cell, its direct child instance count, and its direct shape count.
Args:
session_id: Session returned by open_layout.
max_depth: Only include cells within this many levels of a top cell (0 = top cells
only, 1 = top cells and their direct children). Omit to list every cell.
| Name | Required | Description | Default |
|---|---|---|---|
| max_depth | No | ||
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It discloses ordering (sorted by name), the per-entry payload, and the depth-scoping rule, but says nothing about result size limits, pagination, or performance on large layouts, which are the real risks for a hierarchy listing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loads purpose and sort order, then the return payload, then Args, which is a sensible ordering. The return-field sentence overlaps with the existing output schema, but it is brief and not padded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Both parameters are documented and an output schema already covers return values, so the agent has what it needs to call this correctly. The only gap is the absence of any session/permission or scale caveats that a no-annotation read tool might benefit from.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must define both parameters, and it does: session_id is tied to `open_layout`, and max_depth is explained with concrete edge semantics ('0 = top cells only, 1 = top cells and their direct children') plus the omit-to-list-all default. That is genuine added meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('List cells in the layout hierarchy') plus the sort order, which is materially more informative than the bare name. It does not name or distinguish itself from siblings like describe_cell or query_region, but the purpose itself is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied rather than stated: an agent infers this is the enumeration step after `open_layout`, which the session_id arg indirectly confirms. There is no explicit when-to-use, when-not-to-use, or comparison against describe_cell/query_region, so guidance remains minimal.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_layersA
List every layer in the layout with its layer/datatype, name, and shape count.
Use the returned {layer, datatype} pairs as layer filters in other tools.
Args:
session_id: Session returned by open_layout.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It discloses the returned content and the filter usage, but says nothing about scope (whole layout vs. current view), ordering, pagination/limits, or what happens with an invalid/expired session_id.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the core action, then the output usage hint, then the argument note. No filler; every sentence adds information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-value explanation is not strictly required, and the description covers purpose, argument provenance, and downstream use. It could still note scope/ordering for a listing tool, but nothing essential to correct invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the single parameter has no schema description, so the description must compensate — it does by naming session_id's origin ('Session returned by `open_layout`'), giving the agent a concrete way to obtain it. No format or validation detail beyond that.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('List every layer in the layout') plus the exact returned fields (layer/datatype, name, shape count). This clearly distinguishes it from siblings like list_cells and describe_cell, which operate on cells rather than layers.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explains downstream usage ('use the returned {layer, datatype} pairs as layer filters in other tools') and implies this is the enumeration step, but never states when to prefer it over alternatives such as query_region or describe_cell, nor any preconditions beyond having a session.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
measure_geometryA
Measure a value from shapes previously returned by query_region.
Modes and the number of target_ids they take:
path_width (1), segment_length (1), bend_radius_estimate (1),
centerline_distance (2, bounding-box centers), edge_gap (2, bounding-box gap),
overlap (2, bounding-box overlap area). Results are in microns and database units.
Args:
session_id: Session returned by open_layout.
mode: Measurement mode (see above).
target_ids: Shape ids from query_region.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| session_id | Yes | ||
| target_ids | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the behavioral burden; it discloses output units (microns and database units) and that measurements are bounding-box based for some modes, which are real behavioral facts. It does not state whether the call is read-only, whether shapes must all come from the same query_region invocation, or how invalid target_ids are handled.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose is front-loaded, then modes, then args — a sensible order with no filler prose. The trailing Args block partially restates session_id/mode/target_ids already introduced above, a small redundancy that keeps it from a 5.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return formatting needn't be described, and the description adds the unit convention anyway. Mode arities, prerequisite tools, and parameter provenance are all covered; only edge cases (mismatched sessions, invalid ids, mixed-source shapes) are unaddressed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and even the `mode` string has no enum, so the description is the only documentation — and it fully compensates, enumerating all seven modes with their required target_ids arity and defining the two bounding-box semantics. Each of the three parameters is given provenance and meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Measure a value from shapes') and names the producing sibling (`query_region`), which cleanly separates it from listing/analysis tools like list_cells or analyze_waveguide. The mode list further pins down exactly what kind of measurement is produced.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly ties usage to a prior `query_region` call and requires target_ids sourced from it, plus session_id from `open_layout`, giving a clear call chain. It does not, however, exclude or compare against alternatives such as analyze_waveguide or run_drc_script for related geometry questions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
open_layoutA
Open a GDS or OASIS layout read-only and start a session.
Call this first. The returned session_id is required by every other tool. Sessions
expire after a period of inactivity; call close_session when finished.
Args:
path: Absolute path to a .gds or .oas file.
top_cell: Top cell to use by default. Defaults to the alphabetically first top cell.
format: Explicit format (gds or oas) when the file extension is ambiguous.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| format | No | ||
| top_cell | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does so well: read-only access, session expiry on inactivity, the requirement to close sessions, and the cross-cutting fact that the returned session_id is mandatory for all other tools. It doesn't cover permission failures or error conditions, keeping it out of 5 territory.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loads the critical 'Call this first' instruction, then lifecycle, then a compact Args block. Every sentence adds operational value with no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a session-creating entry-point tool, the description covers purpose, ordering, lifecycle, cleanup, and all three parameters. An output schema exists, so return-value detail is unnecessary, and the one key return field (session_id) is already called out.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it does fully: path is an absolute path restricted to .gds/.oas, top_cell specifies the default with a stated fallback (alphabetically first top cell), and format resolves ambiguity when the extension is unclear. Each parameter gains meaning absent from the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (open), resource (GDS/OASIS layout), and mode (read-only), plus the side effect of starting a session. 'Call this first' immediately distinguishes it from every sibling tool, which all depend on the session it creates.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives clear ordering guidance ('Call this first'), the lifecycle rule (sessions expire after inactivity), and names close_session as the terminating counterpart. It stops short of describing when-not to use it or how it pairs with specific downstream tools, so it falls just below the top.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
query_regionA
Return shapes, text labels, and child instances overlapping a box.
Each returned shape has a session-stable id (e.g. shp_1a2b3c4d). Pass these ids to
measure_geometry, analyze_waveguide, or render_view annotations. Results are
sorted deterministically; truncation reports how many items the limits dropped.
Args:
session_id: Session returned by open_layout.
box: Query window in microns: {"left", "bottom", "right", "top"}.
cell: Cell to query. Defaults to the session's selected top cell.
layers: Optional [{"layer": int, "datatype": int}] filter. Defaults to all layers.
hierarchy_mode: top for shapes placed directly in the cell, or recursive /
flattened to include shapes from child cells transformed into the cell's
coordinates.
max_shapes: Maximum number of shapes to return.
max_instances: Maximum number of child instances to return.
max_texts: Maximum number of text labels to return.
| Name | Required | Description | Default |
|---|---|---|---|
| box | Yes | ||
| cell | No | ||
| layers | No | ||
| max_texts | No | ||
| max_shapes | No | ||
| session_id | Yes | ||
| max_instances | No | ||
| hierarchy_mode | No | recursive |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full behavioral burden and handles it well: it discloses session-stable id semantics, deterministic result ordering, and that truncation reports how many items the caps dropped. It stops short of confirming read-only safety or performance characteristics of recursive queries, but the substantive behaviors are covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The purpose sentence and id-routing note are front-loaded, then the Args block. The block is long, but with 0% schema coverage each line is load-bearing; the phrasing is compact and free of repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For an 8-parameter nested-schema query tool, everything an agent needs is present: required params, formats, enum-like values, defaults, coordinate system, and truncation reporting. An output schema exists, yet the description still usefully explains the id contract that downstream tools depend on.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and there are 8 parameters, so the description must compensate, and it does: every argument gets meaning, including box as microns with an explicit key layout, the layers filter shape, hierarchy_mode's top/recursive/flattened semantics, defaults, and the three truncation caps.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening sentence names a concrete verb (return) and three specific resources (shapes, text labels, child instances) scoped by an overlap box. The mention of handing ids to measure_geometry/analyze_waveguide/render_view makes clear this is the discovery step, not a measurement or rendering tool, distinguishing it from those siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It establishes the workflow context: session_id comes from open_layout, and returned ids feed measure_geometry, analyze_waveguide, or render_view. It does not state when to use this versus a narrower sibling query or any exclusion conditions, but the downstream routing is explicit and useful.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
render_viewA
Render layout geometry to a PNG and return its absolute path.
Arguments given here also update the session's default view (see set_view).
Args:
session_id: Session returned by open_layout.
box: View window in microns. Defaults to the current view.
cell: Cell to render. Defaults to the current view's cell.
layers: Visible layers as [{"layer": int, "datatype": int}].
image_size: Output size in pixels: {"width": int, "height": int}
(default 1200x800).
annotations: Overlays such as
[{"kind": "shape_outline", "target_ids": ["shp_..."], "color": "#ff3b30"}].
Targets must come from query_region on the rendered cell.
style: light, dark, or mask.
| Name | Required | Description | Default |
|---|---|---|---|
| box | No | ||
| cell | No | ||
| style | No | light | |
| layers | No | ||
| image_size | No | ||
| session_id | Yes | ||
| annotations | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well: it discloses the PNG side effect, the non-obvious state mutation ('Arguments given here also update the session's default view'), and a hard prerequisite constraint ('Targets must come from query_region on the rendered cell'). It stops short of discussing cost, latency, or failure modes, but the non-obvious behaviors are surfaced.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the action and return value in sentence one, followed by the state-effect caveat, then a clean per-argument list. Every line earns its place; nothing is repeated from the schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 7-parameter rendering tool with an output schema, the description covers all parameters, the state side effect, the annotation prerequisite, and return semantics. An agent has everything needed to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate fully, and it does: every one of the 7 parameters is documented with format, defaults, and provenance (session_id from `open_layout`, layers as `[{"layer": int, "datatype": int}]`, image_size default 1200x800, style enum values). This adds substantial meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence gives a specific verb ('Render'), resource ('layout geometry'), output ('to a PNG') and return value ('absolute path'). It also positions itself relative to the sibling `set_view` by noting the shared session-state effect, so an agent can distinguish it from that tool without opening the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied by the rendering workflow (open_layout -> query_region -> render_view) and by the reference to `set_view`, but there is no explicit when-to-use / when-not-to-use statement or named alternative. The agent must infer that this is the visual-output step.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_drc_scriptA
Run a KLayout DRC deck in batch mode against the session layout.
The deck receives $input_path and $report_path variables and must write its
report to $report_path. Returns a run_id and marker counts per rule; pass the
run_id to extract_markers for marker locations. Requires the klayout executable
(on PATH or via KLAYOUT_BIN).
Args:
session_id: Session returned by open_layout.
script_path: Absolute path to the DRC deck.
script_type: Deck language. Only ruby is supported.
params: Extra variables passed to the deck with -rd name=value.
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | ||
| session_id | Yes | ||
| script_path | Yes | ||
| script_type | No | ruby |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well: it documents the deck contract ($input_path/$report_path variables, must write to $report_path), a hard environment prerequisite (klayout executable on PATH or KLAYOUT_BIN), and the return payload (run_id + marker counts). It omits failure/timeout behavior and whether the run mutates session state.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the core action, then the deck contract, then follow-up and prerequisites, with an Args list at the end. Efficient and well-organized, though the contract paragraph could be tightened slightly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Output schema exists, yet the description still usefully names run_id and marker counts, and it covers the environment prerequisite and downstream handoff. Complete enough to invoke correctly; only error-handling behavior is unaddressed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it does: session_id is tied to open_layout, script_path is specified as an absolute path, script_type is constrained to ruby only, and params is explained with the -rd name=value forwarding syntax. This is meaningful added meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource+mode: 'Run a KLayout DRC deck in batch mode against the session layout.' It is clearly distinguishable from siblings like extract_markers, which it explicitly names as a downstream step rather than a competing choice.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Establishes context (batch DRC against an open session) and routes the agent to extract_markers via run_id for marker locations. It lacks explicit when-not guidance (e.g., when to prefer interactive/geometry queries over a full deck run), so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
set_viewA
Set the session's default render view used by later render_view calls.
Omitted arguments keep their current value. Changing cell without a box
auto-fits the view to that cell.
Args:
session_id: Session returned by open_layout.
box: View window in microns: {"left", "bottom", "right", "top"}.
cell: Cell to render.
layers: Visible layers as [{"layer": int, "datatype": int}].
| Name | Required | Description | Default |
|---|---|---|---|
| box | No | ||
| cell | No | ||
| layers | No | ||
| session_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does reasonably well: it discloses partial-update semantics ('Omitted arguments keep their current value'), an auto-fit side effect, and that the setting persists for later render_view calls. It omits error/permission behavior and what happens if session_id is stale, which a mutation tool ideally covers.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the core purpose, followed by concise behavioral notes and a tidy Args list. Every sentence carries information, though the Args block is somewhat verbose relative to the schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists so return values need not be explained, and the description covers the mutation semantics and parameter formats adequately for a 4-parameter stateful tool. Remaining gaps (persistence scope, failure modes) are minor against the schema and output schema already provided.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it largely does: it documents all four parameters, gives box's key set and micron units, and specifies the layers shape [{layer, datatype}]. Minor gaps remain, such as whether box requires all four keys and the null/default meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource ('Set the session's default render view') and ties it to the sibling tool render_view, so an agent can distinguish configuring the view from actually rendering it. It is clear, though it does not explicitly say 'use set_view rather than render_view when configuring'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It establishes clear context via its relationship to later render_view calls and gives conditional rules: omitted arguments keep current values, and changing cell without a box auto-fits. It stops short of stating when not to use this tool, so it lacks explicit exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.3.0- Changed
query_region1 field changed- added
Input schema / properties / max_textsAdded value: +{ + "default": 200, + "title": "Max Texts", + "type": "integer" +}
12 tool updates
v0.2.3- First observed
analyze_waveguide - First observed
close_session - First observed
describe_cell - First observed
extract_markers - First observed
list_cells - First observed
list_layers - First observed
measure_geometry - First observed
open_layout - First observed
query_region - First observed
render_view - First observed
run_drc_script - First observed
set_view
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes (session lifecycle, listing, querying, measuring, rendering, DRC), and descriptions clarify boundaries. Minor overlap exists between analyze_waveguide and measure_geometry's path_width/bend_radius_estimate modes, which could cause occasional misselection.
Every tool follows a consistent snake_case verb_noun pattern (open_layout, list_cells, query_region, render_view, extract_markers, etc.), with only minor multi-word variations like run_drc_script that still fit the convention. No style mixing.
12 tools is well-scoped for a read-only layout inspection/analysis server, with each tool covering a distinct capability from session management to DRC. No redundant or filler tools.
The surface covers the full read-only workflow: open/close session, inspect cells and layers, query regions, measure geometry, render views, and run DRC with marker extraction. Edit/write operations are intentionally absent given the read-only design, and there is no way to list past DRC runs, but core workflows are complete.
Maintenance
Related MCP Connectors
Read-only MCP server for wafergraph.com's semiconductor & AI supply-chain data: 30 tools, no auth.
Read-only MCP server exposing a user ORANO library to their own AI agent.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
Related MCP Servers
- AlicenseAqualityAmaintenanceA Model Context Protocol (MCP) server that provides tools for interacting with OpenROAD and ORFS (OpenROAD Flow Scripts).1021BSD 3-Clause
- AlicenseBqualityCmaintenanceMCP server exposing KiCad PCB Editor functionality via IPC API.4133 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceRead-only MCP server for accessing local Kindle library data, exposing tools to query profile, health, and book metadata.MIT
- AlicenseAqualityCmaintenanceA read-only MCP server for AI agents to understand KiCad projects through progressive disclosure, providing compact summaries and drill-down tools for components, nets, traces, and ERC/DRC checks without blowing context budgets.71MIT