Skip to main content
Glama
dsh18235538266-crypto

onshape-mcp-codex

set_variable

Write or update an Onshape Variable Studio variable, enabling other part studios to reference it by #name in expressions such as dimensions and extrudes.

Instructions

Write or update a variable in a Variable Studio. elementId MUST be a Variable Studio element id (from create_variable_studio); writing to a Part Studio /variables endpoint 404s on modern docs. Other Part Studios in the same workspace can reference this variable as #name in any expression (sketch dimensions, extrude depths, etc.).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesVariable name (FS identifier rules)
typeNoFeatureScript variable type. Defaults to LENGTH.
elementIdYesVariable Studio element ID (from create_variable_studio)
documentIdYesDocument ID
expressionYesVariable expression (e.g., '30 mm', '0.75 in', '90 deg')
descriptionNoOptional variable description
workspaceIdYesWorkspace ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With zero annotations, the description carries the full burden, and it delivers substantial behavioral context: the tool mutates (write or update), it has a specific failure mode (404 on Part Studio /variables endpoints on modern docs), and it produces workspace-scoped visibility via '#name' expressions in other Part Studios. It stops short of a 5 because it does not disclose the response/return behavior or any permission requirements for a mutation operation.

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, all load-bearing. The purpose is front-loaded in sentence one; sentence two contains the critical failure-mode constraint; sentence three covers the cross-reference side effect. No filler, no repetition of schema content, and every sentence prevents a distinct class of agent error.

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 no output schema and no annotations, the description covers the highest-risk gaps: correct elementId source, the 404 failure mode, and the downstream referencing semantics. What remains unspecified is the success response shape and the exact behavior when updating an existing variable name that other expressions already reference, which would round it out for a mutation tool.

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 value beyond the schema: it clarifies that elementId must be a Variable Studio element id and explains the consequence of violating that (404 on modern docs), and it tells agents that the 'name' parameter becomes the '#name' reference syntax used across Part Studios. This enrichment justifies one point above baseline.

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 first sentence, 'Write or update a variable in a Variable Studio,' names a specific verb (write/update), a specific resource (variable), and a specific container (Variable Studio). This cleanly distinguishes it from read siblings like get_variables and from create_variable_studio, which creates the container rather than the variable.

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 a clear, explicit when-not: 'writing to a Part Studio /variables endpoint 404s on modern docs,' and it anchors the correct usage by stating elementId MUST be a Variable Studio element id from create_variable_studio. It also explains the benefit of using this tool (cross-Part-Studio #name references). However, it never explicitly names alternative tools for reading variables or for the read path, leaving some routing to inference.

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