Tools (v2 actions)
The agent works through one tool contract, barocss-cad-tools-v2. The chat, cad-mcp and cad-cli all serve this list and nothing else. It has 13 tools:
modelfeaturesqueryhistoryrequirementsproposalsassemblylibraryprintdrawingsubdimagedescribe
How a call looks
A call names a tool, and its arguments carry an action:
{ "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:
modelwith{ "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.
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_proposalat L2, orneeds_approvalfor a change to the assembly, mates, the drawing, the robot or a locked part. - A command's refusal. When the build behind
features.commandrefuses, the call returns that refusal as its error, as<Label>: <refusal>, and the part is left unchanged. - Rows. Rows the agent wrote itself are refused with
[ROWS_NOT_FROM_PERSON]. - All or nothing.
features.batchruns several calls all or nothing, anddryRuntries them without keeping them.model.runruns a whole script the same way.
Use the result for the next call
An accepted part edit returns ok: true, did, feature_count, facts and change. Use these fields to check what changed before making another edit. Body details depend on response_format and the result's size; an omitted face list does not mean the body has no faces. Read the part summary before using a face or edge name you have not seen.
To work on the version you reviewed, pass the revision from query.render or query.rebuild as expectedRevision on features.edit, features.command or features.delete. Use the same part scope for both calls.
Chamfer a sketch corner
Call query.edit_fields with the sketch's index and includeSketchCorners: true. Each sketchCorners entry gives a point in sketch mm and the two saved side IDs that meet there. Copy the read's id into sketchChamfer.sketch and its revision into expectedRevision. For example, use this as an operation in proposals.propose and approve it in Studio.
{
"tool": "features",
"args": {
"action": "edit",
"index": 0,
"expectedRevision": "0123456789abcdef",
"sketchChamfer": { "sketch": "n0", "sides": ["e1", "e2"], "distance": 6 }
}
}The distance is the setback in mm along each of the two straight sides. This edit supports one independent material outline with saved side IDs and no holes. The edit is refused if the corner cannot fit, a constraint or binding would be lost, or the part revision has changed.
For a corner whose sides have horizontal and vertical constraints or a shared perpendicular constraint, Chamfer uses the bevel length and its 135° joint angle to hold both setbacks through a later sketch point drag. You can inspect these constraints in Studio. This applies to convex and reflex corners, including eligible pairs in a grouped edit.
To edit the setback of a saved constrained Chamfer in Studio, reopen the sketch, select the bevel edge, and choose Edit Chamfer. Enter the new setback in Distance and apply the preview.
For an Agent edit, call query.edit_fields with includeSketchCorners: true. Read the saved bevel side ID and current setback from sketchChamfers. Use that side ID as bevel with the same sketch ID, feature index and revision. Stage the operation with proposals.propose and approve it in Studio.
{ "sketchChamfer": { "sketch": "n0", "bevel": "e9", "distance": 8 } }For a saved Chamfer on a standalone XY sketch with one straight extrusion, use the modelReviewRevision from proposals.list to request the four-view PNG with query.render. Pass the base expectedRevision, the proposal ID, and expectedProposalRevision as shown in the group workflow below. Read the changed setback and any retained bevels on a shared side in chamferResize.faces. Inspect those native wall faces using candidate.reviewRevision from that image as expectedReviewRevision. Approve the reviewed change in Studio.
Round a sketch corner
For the same read and approval workflow, send sketchRound instead of sketchChamfer:
{ "sketchRound": { "sketch": "n0", "sides": ["e1", "e2"], "radius": 6 } }Include the sketch's index and expectedRevision as above. Round places a tangent circular arc between two straight sides. Its radius is editable in Studio after approval. The edit refuses a radius that cannot fit, makes contact with another edge, or would remove a saved constraint or binding.
Edit several sketch corners together
Use corners in place of sides to send two or more pairs from the same query.edit_fields result. Keep its sketch ID, feature index and revision in the request. Use one radius or distance in mm for the whole edit.
{ "sketchRound": { "sketch": "n0", "corners": [["e3", "e4"], ["e4", "e5"]], "radius": 6 } }For a bevel, use sketchChamfer with distance and the same list of pairs. Stage the full edit as one operation in proposals.propose and approve it in Studio. Each pair must identify a distinct corner. If any pair fails or the edits consume a shared side, the sketch stays as it was.
For visual review of a group on a standalone sketch with one straight extrusion, read the modelReviewRevision from proposals.list. Call query.render with the proposal ID, the base expectedRevision from query.rebuild, and that proposal pin as expectedProposalRevision. The response includes the four-view PNG, its imageSha256, the native body hash, and the new wall names and their input side pairs in cornerBatch.faces. Pass those names as faces to query.inspect with the same pins and the returned candidate.reviewRevision as expectedReviewRevision. Inspection returns the native plane or cylinder for each face. Both calls read the proposal on a copy. Approve the group in Studio after review.
Review a rectangular S-bend duct
For one pending Exact Sweep from a standalone tagged XY rectangle with one centered rectangular opening and one visible Direct S-bend path, read the modelReviewRevision from proposals.list. Use the same query.render and query.inspect pins as for a sketch corner group. The render identifies the selected path and its revision in rectangularDuct. It also lists both open end-cap faces with their outer and inner edge IDs and the eight joined edge IDs. Use the cap face names and the image's candidate.reviewRevision to inspect the two native cap planes. Approve the reviewed proposal in Studio.
If the model has changed, EDIT_STALE, COMMAND_STALE or DELETE_STALE returns the requested and current revisions. Review the current part before resubmitting. For delete, read the current feature tree to find the new index. In features.batch, the pin applies to the document at the operation's position.
A part-tool refusal returns ok: false and error; fields such as code, detail and kept appear when the handler supplies them. Do not assume every tool result has the object API's code, where and details error fields. Use an available code to select the response, and read the error text for the input to change. For needs_proposal or needs_approval, use the proposal workflow. For an invalid selection or value, ask describe for the action's input schema or the command's selection and values, then correct that input. An unknown tool, action, command or feature request to describe returns error with the available names; use those names rather than guessing.
These calls come from samples/agent-mcp.test.mjs, which runs them through cad-mcp on a 60 × 40 × 8 plate:
// query.measure: a face by its name.
assert.deepEqual(await s.call('query', { action: 'measure', a: 'n1.top' }),
{ isError: false, label: 'Planar face', area: 2400 });
// A new feature at autonomy L2 (the default): refused, the part unchanged.
const hole = await s.call('features', { action: 'command', command: 'hole', faces: ['n1.top'], values: { d: 8, x: 30, y: 20 } });
assert.equal(hole.isError, true);
assert.equal(hole.code, 'needs_proposal');
assert.equal(hole.kept, 'the part is unchanged');
// A call the part can't answer: refused with the reason.
assert.deepEqual(await s.call('features', { action: 'delete', index: 9 }),
{ isError: true, ok: false, error: 'There is no feature 9 (features 0–1).' });At autonomy L3 the same hole applies, and cad-mcp saves the file at once:
const hole = await s.call('features', { action: 'command', command: 'hole', faces: ['n1.top'], values: { d: 8, x: 30, y: 20 } });
assert.equal(hole.isError, false);Review a proposal's drawing
Read the working sheet with drawing.dimensions. For printed diameter and radius annotations, pass include_callouts: true to get the visible text and the drawing source printed in the title block.
To review an open proposal, read its ID and proposalRevision with proposals.list. Call drawing.dimensions again with the same sheet and a review object. Pass the ID as proposal, the working sheet's revision as expectedRevision, and the proposal revision as expectedProposalRevision.
The result contains the working sheet at the top level and the replayed sheet in candidate. Both include their own source, revision, dimensions and printable callouts. Omit include_callouts or set it to true during review. If a proposal reorders the sheets, the candidate reports the new number of the selected sheet. A removed sheet or a stale proposal returns a refusal. The comparison leaves the working file and the proposal decision unchanged.
The per-turn budget
Everything a model reads every turn is held to 25,000 characters at most: the tool list as MCP lists it, and the system prompt. A test fails if it grows past that, so the detail stays behind describe.
Every action
These tables are generated from the contract's source (chat/groups.ts), and the docs check fails if they fall behind it.
model: Model (script)
Builds or changes the part with a script, all or nothing (the language is below).
| Action | Handler | Arguments and notes |
|---|---|---|
model.run | run_script | source, dryRun? |
features: Features
Edit features. Use face and edge names ("n1.top", "n1.side0|n1.side1") or selectors ({"feature":1,"role":"top"}, {"normal":[0,0,1],"pick":"max"}, {"between":[face,face]}).
| Action | Handler | Arguments and notes |
|---|---|---|
features.command | run_command | command, values?, faces?, edges?, bodies?, point?, expectedRevision? |
features.add | add_features | features: [node] — raw feature nodes (sketches, extrudes, revolves, sweeps, lofts, …) |
features.edit | edit_feature | index, values? | feature?, expectedRevision? — detachToDistance:true fixes Extrude length; Box corner proposal: absolute X or match to a second vertex (see describe) |
features.parameters | set_parameters | add?, set?, rename?, bind?, remove? — named parameters; bind a feature's value to one |
features.load_rows | load_rows | kind, file, part?, feature? — rows from the person’s conversation file |
features.delete | delete_feature | index, expectedRevision? |
features.material | set_material | material, bodies?, part? — what bodies are made of |
features.stock | set_stock | file?, remove?, allowance? — the shop's stock list and the allowance |
features.frame_stock | set_frame_stock | file?, remove?, kerf? — the shop's stock lengths for frames and the saw's kerf |
features.frame_sections | set_frame_sections | file?, remove? — your section library: rows a frame names by |
features.welds | set_welds | welds?, remove?, beadOwnership? — joint welds and ownership policy |
features.casting | set_casting | machined?, allowance?, shrink?, gate? — casting faces, allowances and gate |
features.batch | apply_ops | ops: [{tool, args, opId?}], dryRun? — several calls all or nothing |
query: Query
Reads the part without changing it.
| Action | Handler | Arguments and notes |
|---|---|---|
query.summary | get_part_summary | body?, page? — features and persistent geometry names |
query.inspect | inspect | faces?, edges?, curve?, surface?, guidedFill? — native detail and review pins |
query.measure | measure | a, b? — a face or edge, or the distance and angle between two |
query.mass | mass_properties | bodies? — describe for full area |
query.interference | interference | bodies? — overlap and clearance |
query.section | section | axis, at |
query.native_joints | list_native_joints | body |
query.edge_continuity | measure_edge_continuity | body, edgeId, expectedRevision, curvature? |
query.edge_curvature | measure_edge_curvature | body, edgeId, expectedRevision |
query.wall | wall_thickness | body?, below? |
query.draft | draft | body?, pull?, draftMin? |
query.stability | check_stability | datumZ?, minMarginMm?, gravity?, includeInstances? — tipping stability |
query.drop_settle | simulate_drop_settle | datumZ?, dropHeightMm?, durationSec?, body? — gravity drop settle |
query.fit_clearance | fit_clearance | hole?, shaft?, hole_class?, shaft_class?, size? — hole–shaft fit limits |
query.edit_fields | list_feature_edit_fields | index — edit fields and revision |
query.rebuild | rebuild_report | feature timings, kernel calls and mate loops |
query.welds | weld_list | — frame weld joints and seams |
query.cutlist | cut_list | csv? — frame cut list and stock nesting (FR4a, FRb) |
query.bom | output_bom | expectedRevision? — BOM files |
query.purchase_csv | output_purchase_csv | withMade?, expectedRevision? |
query.clearance | output_clearance | near?, expectedRevision? — current assembly map |
query.cam | output_cam_package | part?, toolDiameter?, expectedRevision? — NOT FOR PRODUCTION |
query.render | render_views | highlight?, section?, labels?, explode?, diff?, expectedRevision?, proposal?, expectedProposalRevision? |
query.select | select | faces?, edges?, bodies? — shows them selected in the studio |
query.manufacturability | check_printability | direction?, finish?, sides? — DFM report (print, mould, machining, casting) |
history: History
Checkpoints, versions and branches.
| Action | Handler | Arguments and notes |
|---|---|---|
history.checkpoint | checkpoint | name |
history.restore | restore | name |
history.best | restore_best | — |
history.diff | diff | from?, to? |
history.version | make_version | name? |
history.versions | list_versions | — |
history.restore_version | restore_version | id |
history.compare | compare_versions | from?, to? |
history.approval_evidence | approved_requirement_evidence | from, to, part, later? |
history.branch | make_branch | name |
history.switch | switch_branch | branch |
history.merge | merge_branch | from, resolve? |
requirements: Requirements
The brief (the part's intent), the locked reference bodies it must fit (datums, keep-outs), and the checks the kernel runs.
| Action | Handler | Arguments and notes |
|---|---|---|
requirements.set | set_requirements | requirements: [{id, source, hard?, check}], replace? |
requirements.check | check_spec | validate? or pinned Thicken wall requirement |
requirements.evidence | output_requirement_evidence | part?, expectedRevision? — pinned report |
requirements.plan_tasks | inspect_local_task_plan | occurrences, expectedRevision? |
requirements.brief | set_brief | fields — authored design intent |
requirements.gaps | get_brief | — the brief, its gaps and what it applies |
requirements.references | get_references | — the locked reference bodies, their faces, datums and keep-outs |
requirements.reference | add_reference | name, step | mesh, at? — a locked reference body |
requirements.datum | add_datum | reference + face + kind | reference + vertex | kind + origin + normal | direction |
requirements.keepout | add_keepout | box | cylinder | around + offset, clearance? |
requirements.drafts | get_drafts | — features from an image or drawing and their dimensions to confirm |
requirements.drawing | import_drawing | dxf, name?, plane? — a DXF profile as a sketch draft |
requirements.unref | delete_reference_item | id — a datum or keep-out |
requirements.keepouts | check_keepouts | keepout?, body? — clear, violated or undecided, the chord tolerance stated |
requirements.ask | ask_user | questions: [{id, text, kind, options?, unit?, blocks: {field} | {requirement}}] — only what blocks, ≤ 5, ≤ 2 batches |
proposals: Proposals
A change tried on a copy for the user to accept; the part stays as it is.
| Action | Handler | Arguments and notes |
|---|---|---|
proposals.propose | propose | title, ops (as features.batch), plan?, requirements? |
proposals.accept | accept_proposal | id, leave_out? |
proposals.list | list_proposals | all? |
assembly: Assembly
Parts placed and mated with the base part; changes to it are proposed. A part tool with "part" builds that part.
| Action | Handler | Arguments and notes |
|---|---|---|
assembly.add_step | add_assembly_step | name, parts: exact occurrence IDs — propose for user approval |
assembly.bundle | output_bundle | baseline?, expectedRevision? — approved current evidence files |
assembly.get | get_assembly | faces_of?, include_steps?, step_index?, step_presentation? — saved assembly steps |
assembly.add_part | add_part | name, copy_of?, position?, rotation?, grounded? |
assembly.place | place_part | part, position?, rotation?, name?, grounded?, hidden?, ghost?, opacity?, rigidity?, flexible?, joints?, looks? |
assembly.delete_part | delete_part | part |
assembly.add_mate | add_mate | kind, a, b, distance?, angle?, flip? — a/b |
assembly.edit_mate | edit_mate | id, distance?, angle?, flip?, connectors? |
assembly.lock | lock_part | part, to — fixed to it where they stand |
assembly.pattern | pattern_part | seed, kind: linear | circular, count, spacing?, direction? | angle?, axis?, origin?, orientation?, skip? — the part repeated; copies driven by it |
assembly.edit_pattern | edit_pattern | id, count?, skip?, spacing?, direction? | angle?, axis?, origin?, orientation? |
assembly.delete_pattern | delete_pattern | id |
assembly.cut | cut_parts | id?, profile, at, dir, depth, parts |
assembly.delete_mate | delete_mate | id |
assembly.inputs | set_inputs | inputs: {name: {type, default, bindings, unit?, min?, max?, choices?} | null} |
assembly.variants | set_variants | variants?: {name: {input: value} | null}, active? |
assembly.insert | insert_part | library, part, variant?, params?, name?, position?, rotation? |
assembly.snap | snap_part | a, b, offset? |
assembly.joints | get_joints | — links and joints from the base |
assembly.frames | set_frames | frames: {name: {link, position?, rotation?, kind?} | null} — tool and sensor frames |
assembly.pose | forward_kinematics | values: {joint key: degrees | mm} — where each part is |
assembly.set_pose | set_pose | values: {joint key: degrees | mm} — shown there, nothing stored |
assembly.waypoint | set_waypoint | motion, values?, at?, remove?, limits? — a stored motion's waypoints (degrees, mm) |
assembly.check_path | check_path | motion — a stored motion checked for contact along its timing |
assembly.play | play_motion | motion, samples? — a stored motion's poses over time |
assembly.inertia | link_inertia | — each link's mass, centre of mass and inertia (MMGS, link frame) |
assembly.urdf | export_urdf | name? — the robot as URDF, checked |
assembly.mjcf | export_mjcf | name? — the robot as a MuJoCo MJCF model, checked |
assembly.sweep | sweep_path | to, from? — a joint move checked for collisions, certified |
assembly.motion_clearance | check_motion_clearance | to, from?, steps?, minClearanceMm? — FK clearance & face IDs |
assembly.gravity | gravity_torques | values?, g? — the static torque each joint holds |
assembly.move | motion_torques | to, profile, limits, from?, joint_limits? — a move's peak and RMS torques |
assembly.size | size_actuators | to, profile, limits, from?, joint_limits?, dwell?, serviceLife?, stopDeceleration?, coupled?, motors?, reducers? — motor and reducer sizing |
assembly.set_joints | set_joints | base?, joints?: {key: {lower?, upper?, effort?, velocity?} | null} |
library: Library
Standard and team parts.
| Action | Handler | Arguments and notes |
|---|---|---|
library.standards | standards_lookup | table?, row?, field? — a standards-derived value and its source |
library.list | list_library | library? |
library.add | add_library | library — a library document |
library.add_part | add_library_part | library, part, face, point, variant?, params?, x_direction?, context? |
print: 3D print
Printability on an FDM printer (check: as query.manufacturability).
| Action | Handler | Arguments and notes |
|---|---|---|
print.layers | output_print_layers | part?, layers?, layerHeight?, direction?, overhangLimit?, expectedRevision? |
print.check | check_printability | direction? (an alias, kept for agents that know it) |
print.orient | orient_for_print | apply? |
drawing: Drawing
The part's 2D drawing; a drawing change is always the user's, so make it as ops of proposals.propose.
| Action | Handler | Arguments and notes |
|---|---|---|
drawing.issues | drawing_issues | include_targets? — opaque dimension IDs and view for this snapshot only |
drawing.tolerances | tolerance_suggestions | mode? |
drawing.dimensions | get_drawing_dimensions | sheet?, include_diameters?, include_radii?, include_callouts?, include_svg?, review? |
drawing.stack | calculate_drawing_tolerance_stack | sheet?, expectedRevision from dimensions, terms: [{id, sign: 1 or -1}] |
drawing.auto | auto_dimension | layout? |
drawing.fix | fix_drawing | codes? |
drawing.accept | accept_tolerances | ids?, mode? |
drawing.set | set_drawing | drawing scope, sheet, views, units, annotations and tables; describe gives the fields; propose changes |
subd: SubD
Edit a SubD cage by feature index.
| Action | Handler | Arguments and notes |
|---|---|---|
subd.cage | subd_cage | index |
subd.select | subd_select | index, what, normal?, withinAngle?, box?, edge?, limit?, seedFaces?, cageRevision? |
subd.move | subd_move | index, delta, vertices?, edges?, faces? |
subd.scale | subd_scale | index, cageRevision, factor, vertices?, edges?, faces? |
subd.rotate | subd_rotate | index, cageRevision, axis, degrees, pivotVertex?, vertices?, edges?, faces? |
subd.extrude | subd_extrude | index, faces? | edges?, offset? | distance? |
subd.insert_loop | subd_insert_loop | index, edge, t? |
subd.bridge | subd_bridge | index, edges |
subd.fill | subd_fill | index, edges |
subd.weld | subd_weld | index, vertices, tolerance? |
subd.crease | subd_crease | index, edges? | faces?, on? |
subd.delete | subd_delete | index, faces |
image: Image
A traced picture (a character, logo, icon) as solids.
| Action | Handler | Arguments and notes |
|---|---|---|
image.layers | get_image_layers | image? |
image.measure_pair | measure_photo_pair | frontImage, sideImage, reference, parts |
image.propose_pair | propose_photo_pair | frontImage, sideImage, reference, parts, traceRevision |
image.extrude | extrude_image_layer | width, height, image?, layer?, base?, orientation?, at?, y? |
image.inflate | inflate_image_layer | width, depth, image?, layer?, mode?, body_depth?, orientation?, at?, y? |