Add custom feature
add_custom_featureAdds a custom Feature Studio feature to an Onshape Part Studio using its feature type and parameter IDs, then returns the new feature ID and health status.
Instructions
Add a custom feature (a Feature Studio script such as Thread Creator) to a Part Studio. Find its feature_type and parameter IDs with list_custom_features first. Returns the new feature_id and its health status; if that is ERROR or WARNING, inspect it with list_features(feature_id=...), then fix it with update_feature or remove it with delete_feature.
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": {
"document_id": "<document_id>",
"element_id": "<element_id>",
"feature_type": "<feature_type>"
},
"name": "add_custom_feature"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name; defaults to the script's. | |
| namespace | No | Only to choose between custom features that share a feature_type; copy it exactly from list_custom_features. | |
| element_id | Yes | Element (tab) ID: the string after /e/ in the Onshape URL. Get it from get_document. | |
| parameters | No | Map of parameter ID to value, using the IDs from list_custom_features. Lengths are numbers in the configured unit (strings may carry units or be expressions such as '#width'); angles are degrees; enums take one of the listed options; booleans are true/false; selections (type 'query') are lists of face / edge / part IDs from get_body_details or list_parts. Anything left out keeps the script's own default. | |
| document_id | Yes | Onshape document ID: the 24-character hex string after /documents/ in the document URL. Get it from list_documents. | |
| feature_type | Yes | feature_type of the custom feature, from list_custom_features. | |
| workspace_id | No | Workspace ID (the string after /w/ in the URL). Optional - defaults to the document's main workspace. | |
| feature_studio_url | No | Browser URL of the Feature Studio tab that defines the feature, for a Feature Script that list_custom_features does not show for this Part Studio. From another document it must be a version URL (/documents/<did>/v/<vid>/e/<eid>). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||