onshape_add_feature
Adds a feature to an Onshape Part Studio workspace using a BTMFeature JSON object, enabling sketches, extrudes, and other parametric operations via API.
Instructions
Add a feature to a Part Studio (workspace only). feature is a BTMFeature-134 JSON object, e.g.
{"btType": "BTMFeature-134", "featureType": "extrude", "name": "Extrude 1", "parameters": [...]}.
Read an existing Part Studio with onshape_get_features to see the exact parameter shapes.
Tips: sketches use btType "BTMSketch-151" with featureType "newSketch", a "sketchPlane" query
(default plane deterministicIds: Top "JDC", Front "JCC", Right "JEC") and "entities"
(e.g. BTMSketchCurve-4 + BTCurveGeometryCircle-115, lengths in meters). Extrude takes
bodyType (enumName "ExtendedToolBodyType"), operationType ("NewBodyOperationType": NEW/ADD/REMOVE),
entities (BTMIndividualSketchRegionQuery-140 with the sketch featureId), endBound ("BoundingType": BLIND)
and depth (BTMParameterQuantity-147 expression like "30 mm"). See README for a full tested example.
The response includes featureState - check it for errors (featureStatus != OK).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"did": "<did>",
"wid": "<wid>",
"eid": "<eid>",
"feature": "<feature>"
},
"name": "onshape_add_feature"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| did | Yes | ||
| eid | Yes | ||
| wid | Yes | ||
| feature | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |