Skip to content
AI-Ready Docs
/llms.txt/llms-mcp.txt

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:

  • 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:

AskReturns
{}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_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 <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.batch runs several calls all or nothing, and dryRun tries them without keeping them. model.run runs 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.

json
{
  "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.

json
{ "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:

json
{ "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.

json
{ "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:

mjs
// 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:

mjs
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).

ActionHandlerArguments and notes
model.runrun_scriptsource, 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]}).

ActionHandlerArguments and notes
features.commandrun_commandcommand, values?, faces?, edges?, bodies?, point?, expectedRevision?
features.addadd_featuresfeatures: [node] — raw feature nodes (sketches, extrudes, revolves, sweeps, lofts, …)
features.editedit_featureindex, values? | feature?, expectedRevision? — detachToDistance:true fixes Extrude length; Box corner proposal: absolute X or match to a second vertex (see describe)
features.parametersset_parametersadd?, set?, rename?, bind?, remove? — named parameters; bind a feature's value to one
features.load_rowsload_rowskind, file, part?, feature? — rows from the person’s conversation file
features.deletedelete_featureindex, expectedRevision?
features.materialset_materialmaterial, bodies?, part? — what bodies are made of
features.stockset_stockfile?, remove?, allowance? — the shop's stock list and the allowance
features.frame_stockset_frame_stockfile?, remove?, kerf? — the shop's stock lengths for frames and the saw's kerf
features.frame_sectionsset_frame_sectionsfile?, remove? — your section library: rows a frame names by
features.weldsset_weldswelds?, remove?, beadOwnership? — joint welds and ownership policy
features.castingset_castingmachined?, allowance?, shrink?, gate? — casting faces, allowances and gate
features.batchapply_opsops: [{tool, args, opId?}], dryRun? — several calls all or nothing

query: Query ​

Reads the part without changing it.

ActionHandlerArguments and notes
query.summaryget_part_summarybody?, page? — features and persistent geometry names
query.inspectinspectfaces?, edges?, curve?, surface?, guidedFill? — native detail and review pins
query.measuremeasurea, b? — a face or edge, or the distance and angle between two
query.massmass_propertiesbodies? — describe for full area
query.interferenceinterferencebodies? — overlap and clearance
query.sectionsectionaxis, at
query.native_jointslist_native_jointsbody
query.edge_continuitymeasure_edge_continuitybody, edgeId, expectedRevision, curvature?
query.edge_curvaturemeasure_edge_curvaturebody, edgeId, expectedRevision
query.wallwall_thicknessbody?, below?
query.draftdraftbody?, pull?, draftMin?
query.stabilitycheck_stabilitydatumZ?, minMarginMm?, gravity?, includeInstances? — tipping stability
query.drop_settlesimulate_drop_settledatumZ?, dropHeightMm?, durationSec?, body? — gravity drop settle
query.fit_clearancefit_clearancehole?, shaft?, hole_class?, shaft_class?, size? — hole–shaft fit limits
query.edit_fieldslist_feature_edit_fieldsindex — edit fields and revision
query.rebuildrebuild_reportfeature timings, kernel calls and mate loops
query.weldsweld_list— frame weld joints and seams
query.cutlistcut_listcsv? — frame cut list and stock nesting (FR4a, FRb)
query.bomoutput_bomexpectedRevision? — BOM files
query.purchase_csvoutput_purchase_csvwithMade?, expectedRevision?
query.clearanceoutput_clearancenear?, expectedRevision? — current assembly map
query.camoutput_cam_packagepart?, toolDiameter?, expectedRevision? — NOT FOR PRODUCTION
query.renderrender_viewshighlight?, section?, labels?, explode?, diff?, expectedRevision?, proposal?, expectedProposalRevision?
query.selectselectfaces?, edges?, bodies? — shows them selected in the studio
query.manufacturabilitycheck_printabilitydirection?, finish?, sides? — DFM report (print, mould, machining, casting)

history: History ​

Checkpoints, versions and branches.

ActionHandlerArguments and notes
history.checkpointcheckpointname
history.restorerestorename
history.bestrestore_best—
history.diffdifffrom?, to?
history.versionmake_versionname?
history.versionslist_versions—
history.restore_versionrestore_versionid
history.comparecompare_versionsfrom?, to?
history.approval_evidenceapproved_requirement_evidencefrom, to, part, later?
history.branchmake_branchname
history.switchswitch_branchbranch
history.mergemerge_branchfrom, 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.

ActionHandlerArguments and notes
requirements.setset_requirementsrequirements: [{id, source, hard?, check}], replace?
requirements.checkcheck_specvalidate? or pinned Thicken wall requirement
requirements.evidenceoutput_requirement_evidencepart?, expectedRevision? — pinned report
requirements.plan_tasksinspect_local_task_planoccurrences, expectedRevision?
requirements.briefset_brieffields — authored design intent
requirements.gapsget_brief— the brief, its gaps and what it applies
requirements.referencesget_references— the locked reference bodies, their faces, datums and keep-outs
requirements.referenceadd_referencename, step | mesh, at? — a locked reference body
requirements.datumadd_datumreference + face + kind | reference + vertex | kind + origin + normal | direction
requirements.keepoutadd_keepoutbox | cylinder | around + offset, clearance?
requirements.draftsget_drafts— features from an image or drawing and their dimensions to confirm
requirements.drawingimport_drawingdxf, name?, plane? — a DXF profile as a sketch draft
requirements.unrefdelete_reference_itemid — a datum or keep-out
requirements.keepoutscheck_keepoutskeepout?, body? — clear, violated or undecided, the chord tolerance stated
requirements.askask_userquestions: [{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.

ActionHandlerArguments and notes
proposals.proposeproposetitle, ops (as features.batch), plan?, requirements?
proposals.acceptaccept_proposalid, leave_out?
proposals.listlist_proposalsall?

assembly: Assembly ​

Parts placed and mated with the base part; changes to it are proposed. A part tool with "part" builds that part.

ActionHandlerArguments and notes
assembly.add_stepadd_assembly_stepname, parts: exact occurrence IDs — propose for user approval
assembly.bundleoutput_bundlebaseline?, expectedRevision? — approved current evidence files
assembly.getget_assemblyfaces_of?, include_steps?, step_index?, step_presentation? — saved assembly steps
assembly.add_partadd_partname, copy_of?, position?, rotation?, grounded?
assembly.placeplace_partpart, position?, rotation?, name?, grounded?, hidden?, ghost?, opacity?, rigidity?, flexible?, joints?, looks?
assembly.delete_partdelete_partpart
assembly.add_mateadd_matekind, a, b, distance?, angle?, flip? — a/b
assembly.edit_mateedit_mateid, distance?, angle?, flip?, connectors?
assembly.locklock_partpart, to — fixed to it where they stand
assembly.patternpattern_partseed, kind: linear | circular, count, spacing?, direction? | angle?, axis?, origin?, orientation?, skip? — the part repeated; copies driven by it
assembly.edit_patternedit_patternid, count?, skip?, spacing?, direction? | angle?, axis?, origin?, orientation?
assembly.delete_patterndelete_patternid
assembly.cutcut_partsid?, profile, at, dir, depth, parts
assembly.delete_matedelete_mateid
assembly.inputsset_inputsinputs: {name: {type, default, bindings, unit?, min?, max?, choices?} | null}
assembly.variantsset_variantsvariants?: {name: {input: value} | null}, active?
assembly.insertinsert_partlibrary, part, variant?, params?, name?, position?, rotation?
assembly.snapsnap_parta, b, offset?
assembly.jointsget_joints— links and joints from the base
assembly.framesset_framesframes: {name: {link, position?, rotation?, kind?} | null} — tool and sensor frames
assembly.poseforward_kinematicsvalues: {joint key: degrees | mm} — where each part is
assembly.set_poseset_posevalues: {joint key: degrees | mm} — shown there, nothing stored
assembly.waypointset_waypointmotion, values?, at?, remove?, limits? — a stored motion's waypoints (degrees, mm)
assembly.check_pathcheck_pathmotion — a stored motion checked for contact along its timing
assembly.playplay_motionmotion, samples? — a stored motion's poses over time
assembly.inertialink_inertia— each link's mass, centre of mass and inertia (MMGS, link frame)
assembly.urdfexport_urdfname? — the robot as URDF, checked
assembly.mjcfexport_mjcfname? — the robot as a MuJoCo MJCF model, checked
assembly.sweepsweep_pathto, from? — a joint move checked for collisions, certified
assembly.motion_clearancecheck_motion_clearanceto, from?, steps?, minClearanceMm? — FK clearance & face IDs
assembly.gravitygravity_torquesvalues?, g? — the static torque each joint holds
assembly.movemotion_torquesto, profile, limits, from?, joint_limits? — a move's peak and RMS torques
assembly.sizesize_actuatorsto, profile, limits, from?, joint_limits?, dwell?, serviceLife?, stopDeceleration?, coupled?, motors?, reducers? — motor and reducer sizing
assembly.set_jointsset_jointsbase?, joints?: {key: {lower?, upper?, effort?, velocity?} | null}

library: Library ​

Standard and team parts.

ActionHandlerArguments and notes
library.standardsstandards_lookuptable?, row?, field? — a standards-derived value and its source
library.listlist_librarylibrary?
library.addadd_librarylibrary — a library document
library.add_partadd_library_partlibrary, part, face, point, variant?, params?, x_direction?, context?

Printability on an FDM printer (check: as query.manufacturability).

ActionHandlerArguments and notes
print.layersoutput_print_layerspart?, layers?, layerHeight?, direction?, overhangLimit?, expectedRevision?
print.checkcheck_printabilitydirection? (an alias, kept for agents that know it)
print.orientorient_for_printapply?

drawing: Drawing ​

The part's 2D drawing; a drawing change is always the user's, so make it as ops of proposals.propose.

ActionHandlerArguments and notes
drawing.issuesdrawing_issuesinclude_targets? — opaque dimension IDs and view for this snapshot only
drawing.tolerancestolerance_suggestionsmode?
drawing.dimensionsget_drawing_dimensionssheet?, include_diameters?, include_radii?, include_callouts?, include_svg?, review?
drawing.stackcalculate_drawing_tolerance_stacksheet?, expectedRevision from dimensions, terms: [{id, sign: 1 or -1}]
drawing.autoauto_dimensionlayout?
drawing.fixfix_drawingcodes?
drawing.acceptaccept_tolerancesids?, mode?
drawing.setset_drawingdrawing scope, sheet, views, units, annotations and tables; describe gives the fields; propose changes

subd: SubD ​

Edit a SubD cage by feature index.

ActionHandlerArguments and notes
subd.cagesubd_cageindex
subd.selectsubd_selectindex, what, normal?, withinAngle?, box?, edge?, limit?, seedFaces?, cageRevision?
subd.movesubd_moveindex, delta, vertices?, edges?, faces?
subd.scalesubd_scaleindex, cageRevision, factor, vertices?, edges?, faces?
subd.rotatesubd_rotateindex, cageRevision, axis, degrees, pivotVertex?, vertices?, edges?, faces?
subd.extrudesubd_extrudeindex, faces? | edges?, offset? | distance?
subd.insert_loopsubd_insert_loopindex, edge, t?
subd.bridgesubd_bridgeindex, edges
subd.fillsubd_fillindex, edges
subd.weldsubd_weldindex, vertices, tolerance?
subd.creasesubd_creaseindex, edges? | faces?, on?
subd.deletesubd_deleteindex, faces

image: Image ​

A traced picture (a character, logo, icon) as solids.

ActionHandlerArguments and notes
image.layersget_image_layersimage?
image.measure_pairmeasure_photo_pairfrontImage, sideImage, reference, parts
image.propose_pairpropose_photo_pairfrontImage, sideImage, reference, parts, traceRevision
image.extrudeextrude_image_layerwidth, height, image?, layer?, base?, orientation?, at?, y?
image.inflateinflate_image_layerwidth, depth, image?, layer?, mode?, body_depth?, orientation?, at?, y?