Skip to main content
Glama
onshape-mcp

onshape-mcp

by gpambrozio

Set a Part Studio variable

onshape_set_variable

Create or update a variable. Feature tools can then reference it by name (depth_variable, radius_variable, ...) so a dimension lives 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. On the feature route an existing variable of the same name is rewritten in place, so features built after it pick up the new value (result.action is updated or created).

Input 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/5.0
Behavior4/5

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

With only a title annotation, the description carries the full burden and does well: it discloses the dual route (variable table vs. assignVariable feature), the fallback, the in-place rewrite on the feature route, and the result.route/result.action indicators. It stops short of explaining what happens on the variable table route when a variable of the same name already exists, or what permissions/errors to expect, so a meaningful gap remains.

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?

Four tightly packed sentences with zero filler, front-loaded with the verb phrase. Every sentence contributes a distinct fact—purpose, value, route mechanism, and rewrite behavior—so no trimming is warranted.

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?

Given there is no output schema, the description usefully previews result.route and result.action, which an agent would otherwise have to discover by trial. It does not state the full return shape, error conditions, or authentication requirements, and omits whether the variable-table route also overwrites same-named variables, so it is strong but not complete.

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 schema already documents all seven parameters (including units and the no-leading-# rule). The description adds no parameter-specific syntax or constraints beyond what the schema provides, making the baseline 3 appropriate.

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?

States a specific verb and resource ('Create or update a variable') and immediately distinguishes it from read-only siblings like onshape_get_variables by describing the write/upsert semantics. It also names what the variable is for (feature tools referencing it by name), so an agent can tell exactly what this tool accomplishes.

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 rationale ('so a dimension lives in one place') implies when to use it, but there is no explicit guidance on when not to use it or which sibling to prefer. Alternatives such as onshape_get_variables or onshape_delete_feature are never named, leaving the agent to infer the selection criteria.

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