Skip to main content
Glama
gpambrozio

onshape-mcp

by gpambrozio

Set a Part Studio variable

onshape_set_variable

Create or update a named variable in an Onshape document. Reference it by name in feature tools to keep dimensions in one place.

Instructions

Create or update a variable. Feature tools can then reference it by name (depth_variable, radius_variable, ...) so a dimension lives in one place. Uses the variable table where the account supports it and falls back to an assignVariable feature otherwise; result.route says which was used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wsYesWorkspace id — the <ws> segment of the document URL.
docYesDocument id — the <doc> in cad.onshape.com/documents/<doc>/w/<ws>/e/<elem>.
elemYesElement id (tab) — the <elem> segment of the document URL.
nameYesVariable name, without the leading #.
typeNoVariable type; inferred from the expression's units when omitted.
expressionYesValue expression with units, e.g. "0.25 in" or "2 * #wall".
descriptionNoWhat the variable means.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no readOnly or destructive annotations present, the description carries the behavioral disclosure burden. It goes beyond a simple 'set variable' statement by revealing the internal fallback behavior (variable table vs. assignVariable feature) and pointing to result.route for disambiguation. This is valuable behavioral context.

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?

Three sentences, with the core action front-loaded and no filler. The purpose, use case, and implementation caveat each merit their sentence. Nothing is redundant.

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?

For a tool with 7 parameters and no output schema, the description adequately covers what the tool does, why it is used, and a key behavioral detail about fallback routing. It could mention an explicit alternative or error behavior, but it is sufficiently complete for correct invocation.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds no parameter-specific semantics beyond the schema; it mentions names like depth_variable but the schema already explains the name and expression fields. It earns the baseline but not more.

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 opens with a specific verb and resource: 'Create or update a variable.' It also explains the purpose of the variable (referenced by feature tools so a dimension lives in one place), which clearly distinguishes it from the sibling getter onshape_get_variables.

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

Usage Guidelines4/5

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

The description gives clear context for when this tool is useful—defining a named variable once so feature tools can reference it. It does not explicitly name alternatives or when-not-to-use conditions, but the intended use case is unambiguous enough for an agent to select it appropriately.

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

Deploy Server

Other Tools