Skip to main content
Glama
tureruygar-glitch

kicad10-mcp

execute_kipy

Execute arbitrary Python in a live KiCad session for full control over PCB and schematic edits when dedicated tools fall short.

Instructions

Run arbitrary Python against the live KiCad session (FULL-CONTROL escape hatch).

Use this for anything not covered by a dedicated tool. The code runs in-process with these names pre-bound:

  • kicad: connected kipy.KiCad instance

  • board: the open Board, or None if no PCB is open

  • schematic: the open Schematic, or None

  • kipy, board_types, geometry, commit

  • Vector2, Angle, BoardLayer, KiCadObjectType

Conventions:

  • Internal units are nanometres; build points with Vector2.from_xy_mm(x, y).

  • Group board edits in a single undo step: with commit(board, "my change"): board.create_items(item)

  • Assign a variable named result to return structured data; anything printed to stdout is also captured.

Args: code: Python source to execute. autosave: If True and a board is open, save it after the code runs.

Example: code = ''' from kipy.board_types import Track from kipy.geometry import Vector2 t = Track() t.start = Vector2.from_xy_mm(10, 10) t.end = Vector2.from_xy_mm(20, 10) t.width = 250000 # 0.25 mm in nm t.layer = BoardLayer.BL_F_Cu with commit(board, "api track"): created = board.create_items(t) result = [c.id.value for c in created] '''

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
autosaveNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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 in-process execution, the pre-bound names, nanometre internal units, undo grouping via a commit context manager, result-variable return, stdout capture, and autosave semantics. It stops short of flagging that arbitrary code can be destructive or irreversible, which is the one behavioral caveat an escape hatch should spell out.

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

Conciseness4/5

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

Front-loaded with the purpose and escape-hatch framing, then organized into bindings, conventions, args, and a worked example. The example is lengthy but earns its place for an arbitrary-code tool; the block is dense with no filler sentences.

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

Completeness5/5

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

For a complex, full-control tool with no annotations and 0% schema coverage, the description supplies everything needed to invoke it safely and correctly: available bindings, unit conventions, mutation pattern, and output channel. An output schema exists, and the description reinforces rather than duplicates it.

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

Parameters4/5

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: it explains that `autosave` saves the open board after the code runs (conditional on a board being open) and defines how `code` communicates output via a `result` variable and captured stdout. The `code` parameter itself is only trivially described, keeping this from a 5.

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?

States a specific verb and resource ('Run arbitrary Python against the live KiCad session') and immediately frames the scope as a FULL-CONTROL escape hatch. The routing statement 'anything not covered by a dedicated tool' cleanly distinguishes it from the 70+ dedicated siblings like add_track or move_footprint.

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

Usage Guidelines5/5

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

Gives an explicit selection rule: use this only for what the dedicated tools don't cover, which is exactly the decision an agent faces given the dense sibling list. It also names the prerequisites implicitly (a live session, an open Board/Schematic) and the fact those bindings may be None.

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

Deploy Server

Other Tools