# BaroCSS CAD — AI Agent & MCP Tool Contract > 132 structured CAD actions for `cad-mcp`, `cad-cli`, Browser AI Runner, and WebMCP, plus autonomy guardrails (L1–L4) and typed refusal codes. --- # Designing with the AI Copilot BaroCSS CAD's AI Copilot works directly on the live `.bcad` document using the exact same parametric modeling, drawing, DFM, and inspection commands you use in Studio. Every geometry edit is validated by the B-Rep kernel — never approximated meshes. ## Three AI runtime modes (Provider-Agnostic) Switch runtimes directly from the Chat header without restarting Studio: 1. **Browser AI Runner (BYOK).** Connect directly from the browser using your own Anthropic, OpenAI, or Gemini API key. Runs the full tool loop client-side with automatic multi-angle visual self-verification. 2. **Local CLI bridge.** Connect Studio to your signed-in local CLI session without exposing credentials to the browser. 3. **External coding agents (MCP).** Connect Claude Code or other MCP-compatible agents directly to `.bcad` files — see [Headless CLI & MCP Server](/agent/cli) for 1-command setup. ## ⌘K 3D Spatial Pin & Floating Proposal Bar You do not need to type coordinates or feature IDs in a sidebar chat: 1. Select any face, edge, or body in the 3D viewport and press ⌘K (`Ctrl+K`). 2. The **3D Spatial Pin** inline prompt anchors directly to the picked geometry, automatically attaching its persistent face/edge identity, surrounding model context, and a live viewport capture. 3. Describe the edit (for example, `"add 2 mm fillets around this pocket"` or `"mount four M5 holes 8 mm from the corners"`). 4. Review structural edits right on the canvas in the **Floating Proposal Review Bar** with **Preview**, **Accept**, and **Reject**. Need multiple design directions at once? Open the [Generative Variant Explorer](/agent/variants) to evaluate parallel candidates with live parameter sliders. ## What the agent can do - **Model & edit parametrically:** Run any Studio command, author parametric features, place assembly parts and mates, edit 2D drawings, and manipulate SubD cages. - **Inspect exact geometry & visuals:** Query feature trees, persistent face/edge references, exact distances, mass properties, interference, wall thickness, draft angles, DFM reports, and multi-angle renders. - **Maintain the design brief:** Track user-stated vs. agent-assumed parameters and run hard/soft requirement checks automatically. User-stated values are never silently overwritten. - **Work from images & drawings:** Attach up to four PNG, JPEG, WebP, or GIF files per turn to trace profiles into solids or create confirmable draft features. - **Load verified Shop Rows:** Attach a JSON rows file and ask the agent to load it (see [Shop rows](/studio/rows)). ## Guardrails & autonomy (L1–L4) - **People own shop standards:** The agent cannot fabricate or load its own fastener/casting tables (`[ROWS_NOT_FROM_PERSON]`). - **Explicit approval for high-impact edits:** At default autonomy (`L2`), single-feature parameter tweaks and initial empty-part builds apply directly (with instant **Undo**). Structural edits, assemblies, mates, drawings, robot settings, and locked parts always wait in a reviewable proposal. See [Proposals and autonomy](/agent/proposals). - **Concurrent editing:** Keep modeling while a turn runs — non-colliding changes merge automatically, while colliding edits surface cleanly as proposals. ## Example turn flow These captures show the deterministic proposal lifecycle exercised against the real tool layer: 1. *"A 60 × 40 plate, 8 thick."* On an empty part at `L2`, the initial build applies directly with an **Applied by the agent** toast and one-click **Undo**. ![The first build applied directly, with the Applied by the agent toast](/shots/agent/turn-applied.jpg) 2. *"Make it 10 thick, with an 8 mm hole in the middle."* Because this combines a dimension change with a new structural feature, `L2` refuses direct mutation and returns **P1** for visual preview and approval. ![The chat column showing thinking, tool calls, the refused direct batch, and proposal P1](/shots/agent/proposals/refused-then-proposed.png) Continue to [Generative Variant Explorer & Visual Self-Verification](/agent/variants), [Tools](/agent/tools), [MCP and CLI](/agent/cli), or [AI-Ready Docs (`/llms.txt`)](/agent/ai-ready). --- # Generative Variant Explorer and Visual Self-Verification BaroCSS CAD combines parallel background evaluation with closed-loop visual inspection so AI-assisted edits stay fast, comparable, and geometrically sound. ## Generative Variant Explorer Instead of committing to a single AI guess, the **Generative Variant Explorer** evaluates multiple parametric and topological candidates in parallel without blocking your viewport: - **Parallel comparison cards:** View 3D previews of candidate designs side by side while continuing to orbit or inspect. - **Live parameter sliders:** Scrub exposed dimensions across variants and watch exact volume, mass, and bounding boxes update in real time. - **Requirement & DFM scoring:** Compare each candidate against active design brief constraints before promoting one to the active document. - **Non-destructive promotion:** Accepting a variant writes a single undoable step into the feature history. ## Visual self-verification and 1-click repair ### Multi-angle visual inspection loop In the Browser AI Runner, the agent does not stop after making a modeling edit: 1. After authoring or modifying geometry, the agent captures multi-angle visual views of the evaluated 3D solid. 2. The multimodal model inspects those views alongside exact mass properties, bounds, interference, and requirement checks to catch misplaced holes, inverted extrusions, or unintended intersections before presenting a proposal. ### Design Health & 3D error callout When a parametric edit invalidates a downstream feature (for example, an oversized fillet radius or a missing face reference): - The **Design Health** indicator in the top bar highlights the exact failure count and diagnostic category. - Clicking an issue focuses a **3D error callout** directly on the affected face or edge in the viewport. - Choose **1-click repair** to apply a deterministic fix (such as clamping a radius to geometric bounds) or send the structured diagnostic straight to the AI Copilot for a guided proposal. See [AI Copilot & Spatial Pin](/agent/), [Proposals and autonomy](/agent/proposals), and [Refusal Codes](/reference/refusals). --- # Tools (v2 actions) The agent works through one tool contract, `barocss-cad-tools-v2`. The chat, [`cad-mcp`](/agent/cli) and [`cad-cli`](/agent/cli) all serve this list and nothing else. It has 13 tools: - `model` - `features` - `query` - `history` - `requirements` - `proposals` - `assembly` - `library` - `print` - `drawing` - `subd` - `image` - `describe` ## How a call looks A call names a tool, and its arguments carry an `action`: ```json { "name": "query", "arguments": { "action": "measure", "a": "n1.top" } } ``` That is `query.measure`. - **One action.** A tool with a single action takes it without saying so: `model` with `{ "source": … }` runs a script. - **The handlers.** Each action stands for one of the tool layer's handlers. The call goes through that handler's own gates and gives its results and refusals. - **Naming faces and edges.** Faces and edges are named as the studio names them: `n1.top`, or an edge as two faces, `n1.side0|n1.side1`. Selectors work too: `{"feature": 1, "role": "top"}`, `{"normal": [0, 0, 1], "pick": "max"}`. ## `describe` The list a model reads each turn stays short, and `describe` gives the detail on request: | Ask | Returns | |---|---| | `{}` | Every tool's actions | | `{"tool"}` | That tool's actions | | `{"tool", "action"}` | The action's full description and arguments | | `{"command"}` | A command's selection and values | | `{"feature"}` | A feature kind's node JSON | New commands and feature kinds need no change to the list. The `features` tool names them, and `describe` gives their detail. For example, the agent mounts a motor with `features.command` and the command `mount`, on a picked face, after loading the person's mount rows with `features.load_rows` and the kind `mounts`. A mount adds features, so at L1 and L2 it is proposed. See [Part features](/studio/features#machine-elements). ## Results and refusals - **Data back.** A call returns JSON. A read gives what it read; a change says what it changed. - **Refusals.** A refused call leaves the part exactly as it was and says why, often with a code the agent can act on. For example, `needs_proposal` at L2, or `needs_approval` for a change to the assembly, mates, the drawing, the robot or a locked part. - **A command's refusal.** When the build behind `features.command` refuses, the call returns that refusal as its error, as `