Skip to main content
Glama
onshape-jamcp

onshape-jamcp

Set a variable

set_variable
Idempotent

Create or update Part Studio variables, including multiple values in one call, so changing a key dimension reshapes the whole model.

Instructions

Create a Part Studio variable, or change its value if it already exists. By default model with variables: put every key dimension (diameter, length, pitch, wall thickness, ...) in a variable first, then use '#name' wherever the size is needed, so changing one value reshapes the whole model. Pass variables to set many in one call.

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>"
    },
    "name": "set_variable"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoQuantity type; only used when the variable is created.length
nameNoVariable name: letters, digits and underscores, e.g. 'shank_diameter'. Referenced as '#shank_diameter'. Omit when using `variables`.
valueNoA number (length in the configured unit, degrees for an angle), a string with a unit ('1.5 mm'), or an expression using other variables ('#shank_diameter / 2'). Omit when using by_option.
by_optionNoMake the value depend on a configuration LIST input: {'Size': {'M10': 10, 'M18': 18}} gives 10 for M10 and 18 for M18. Every option of the input needs a value. Create the input first with set_configuration_input. Only when the user asks for configurations.
variablesNoSet SEVERAL variables at once, e.g. {'d': 10, 'pitch': 1.5, 'head_h': 6.4}: existing ones change in ONE Onshape request, new ones are created. Instead of name / value.
element_idYesElement (tab) ID: the string after /e/ in the Onshape URL. Get it from get_document.
document_idYesOnshape document ID: the 24-character hex string after /documents/ in the document URL. Get it from list_documents.
workspace_idNoWorkspace ID (the string after /w/ in the URL). Optional - defaults to the document's main workspace.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.1

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare idempotent, non-destructive, open-world behavior, so the bar is lower. The description adds real value beyond them: it discloses the create-or-update upsert semantics, that batch sets happen in ONE Onshape request, and that `by_option` requires a configuration input created first via set_configuration_input.

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

Conciseness4/5

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

Front-loaded with the core action and upsert behavior, then guidance. The modeling-advice sentence is longer than strictly necessary but still earns its place as actionable guidance; no filler.

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?

With an output schema, full parameter descriptions, and annotations present, the description covers the remaining gaps an agent needs: upsert semantics, batch mode, and the configuration-input prerequisite. Nothing critical is missing.

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 baseline is 3, but the description adds meaning beyond the schema by clarifying the mutual exclusivity of `name`/`value` versus `variables` and the dependency of `by_option` on a pre-existing configuration input.

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 a Part Studio variable') plus the upsert behavior ('change its value if it already exists'), which immediately distinguishes it from read-only siblings like list_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?

Gives clear usage context: model with variables for key dimensions, use `variables` to set many in one call, and use `by_option` 'Only when the user asks for configurations.' It lacks an explicit pointer to list_variables for reading values, but the when-to-use conditions are concrete.

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