--- name: cadcraft description: Create and edit CAD drawings, entities, layers, and layouts or automate workflows in the CADCraft application using its control protocol, MCP bridge, or headless CLI. Use when the user asks to work in CADCraft. --- # CADCraft Operate CADCraft through its structured automation interface. Preserve the user's requested drafting workflow and target drawing. ## Protocol reference Read the relevant sections of [references/control-protocol.md](references/control-protocol.md) before constructing calls. This is the downloaded upstream protocol, captured on 2026-11-09. Source: [CADCraft control protocol](https://raw.githubusercontent.com/storytold/cadcraft/refs/heads/main/docs/control-protocol.md). Useful sections: the **method table** (top of the document), **Panel docking**, **Command-line replies**, and **Interface language**. Relative links inside the downloaded document (e.g. `localization.md`) refer to upstream documentation; resolve them against `https://github.com/storytold/cadcraft/blob/main/docs/` when needed. The document is short and does not list individual drawing commands: discover them at runtime with `engine.commands` instead of inventing command IDs or parameters. ## Locate the executables `cadcraft` and `cadcraft-cli` may not be on `PATH` even when CADCraft is installed. Discover them before assuming anything is missing, and never invent a path — search for it: 1. **PATH:** `command -v cadcraft cadcraft-cli` (POSIX) or `where cadcraft cadcraft-cli` (Windows). 2. **macOS:** look for `CADCraft.app` in `/Applications` and `~/Applications`, or run `mdfind -name CADCraft.app`; the binary inside `Contents/MacOS/` is the desktop app. 3. **Linux / Windows:** check the usual install locations and the target of any desktop or Start-Menu shortcut. 4. **`cadcraft-cli` missing is not a blocker.** The control port speaks plain line-delimited JSON over loopback TCP and needs no bridge: send one request per line, e.g. `{"id":1,"method":"cmdline.input","params":{"text":"circle 0,0 5"}}`, and match replies by `id` and `ok`. A short script in any language covers every method. ## Select the session - For a user's open drawing or visible application, use an existing CADCraft MCP bridge or control session. A headless session has its own in-process drawings and cannot edit the user's live window. - For unattended processing of files, use headless MCP (`cadcraft-cli mcp`). - Discover available CADCraft tools and installed executables first. If the required connection or executable is missing, report the concrete prerequisite; creating this skill does not install CADCraft or register an MCP server. Start a desktop session with `--control PORT` (or `CADCRAFT_CONTROL_PORT=PORT`); it listens on `127.0.0.1:PORT`. Bridge it with: ```sh cadcraft-cli mcp --connect 127.0.0.1:PORT ``` Reuse a running session when possible and keep TCP on loopback. The upstream protocol documents no authentication handshake or file-access roots; if the installed version requires a token or roots, follow its `--help` output rather than guessing. Use `CADCRAFT_CONFIG_DIR` to point the app at a private, isolated profile for automation (an explicitly empty value disables workspace reads and writes). Do not edit the user's `workspace.json` directly. ## Inspect, edit, and verify Inspect before editing: `drawing.inspect` for counts, extents, layers, styles, blocks, layouts, selection, and undo state; `ui.inspect` for the UI state, active view, and any pending "Save changes?" prompt (`closePrompt`); `cmdline.state` for the current prompt. The app may restore or already hold drawings you did not create. Two ways to edit: - **Command line** — `cmdline.input {text}` behaves exactly like a user typing: it starts commands by name or alias and answers prompts (points `x,y`, relative `@dx,dy`, polar `@d