Skip to main content
Glama
hedless

Onshape MCP Server

by hedless

set_variable

Set or update a single variable in an Onshape Variable Studio while preserving all other variables. The type is automatically determined from the expression's units, enabling precise control over CAD parameters.

Instructions

Set or update a variable in a Variable Studio, preserving the other variables. The type (LENGTH/ANGLE/ANY) is inferred from the expression's units

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesVariable name
elementIdYesVariable Studio element ID (create one with create_variable_studio)
documentIdYesDocument ID
expressionYesVariable expression (e.g., '0.75 in')
descriptionNoOptional variable description
workspaceIdYesWorkspace ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.0
    • changedInput schema / properties / elementId / description
      Previous value: -"Part Studio element ID"New value: +"Variable Studio element ID (create one with create_variable_studio)"
  2. First observedv0.3.0

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It discloses the key side-effect (other variables are preserved) and a nontrivial inference behavior (type is derived from expression units). However, it does not state whether the variable must already exist, what the operation returns, or any permission requirements, which leaves some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler: the primary action and side-effect are front-loaded, and the type-inference rule is stated in a separate clause. Every phrase earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Together with the schema, the description gives an agent the action, the side-effect, the type-inference rule, and a creation hint on elementId. It is slightly incomplete regarding the return value, overwrite behavior when the variable already exists, and the read/precondition relationship with get_variables, but it is sufficient for a straightforward setter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds real meaning to the expression parameter by explaining that its units determine the LENGTH/ANGLE/ANY type, which the schema's simple example does not convey. This goes beyond the structured field documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource ('Set or update a variable in a Variable Studio') and adds discriminating details: preservation of other variables and unit-based type inference. These details separate it from get_variables (read) and create_variable_studio (studio creation), even without naming them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use is implied by 'Set or update a variable', but there is no explicit when-to-use guidance or alternatives. The description never tells the agent to prefer this tool for variable mutations while using get_variables for reads, nor does it mention that the Variable Studio must already exist before calling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.