Skip to main content
Glama
onshape-jamcp

onshape-jamcp

Evaluate FeatureScript

run_featurescript
Read-only

Evaluate a read-only FeatureScript snippet against an Onshape Part Studio to run custom queries—such as face counts, distances, or selections—and return the result without modifying the document.

Instructions

Evaluate a read-only FeatureScript snippet against a Part Studio and return its result. Powerful for queries the other tools do not cover (face counts, distances, evaluating selections). It cannot modify the document. NOTE: lengths inside FeatureScript results are in METERS, not the configured unit.

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

Input Schema

NameRequiredDescriptionDefault
scriptYesA FeatureScript lambda, e.g. `function(context is Context, queries) { return size(evaluateQuery(context, qEverything(EntityType.FACE))); }`.
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.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, and the description reinforces the safety profile ('cannot modify the document') rather than contradicting it. It adds genuinely non-obvious behavior the annotations cannot convey: that result lengths come back in METERS regardless of the configured document unit, which prevents a common downstream misinterpretation.

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 short sentences, each carrying distinct information: what it does, when to reach for it, what it cannot do, and the unit caveat. The core purpose is front-loaded and there is no restating of the name or title.

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 present, the description need not explain return values, and the units caveat covers the one semantic trap in the response. What remains unstated are execution-side limits (timeouts, sandbox restrictions, what happens on a malformed script), which matter for a tool accepting up to 20,000 characters of arbitrary code.

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 four parameters, including the script lambda example and how to obtain document_id/element_id. The description adds only the implicit framing that the script runs 'against a Part Studio', with no further meaning for script, element_id, or workspace_id. Baseline 3 applies.

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 ('Evaluate a read-only FeatureScript snippet against a Part Studio and return its result') and explicitly positions it as covering 'queries the other tools do not cover (face counts, distances, evaluating selections)', which separates it from the geometry siblings like extrude/fillet/get_part_properties. An agent can decide between this and the dedicated tools without opening the schema.

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 a clear when-to-use rule ('queries the other tools do not cover') plus concrete example use cases, and a when-not rule in effect ('It cannot modify the document'). It stops short of naming specific sibling tools to prefer for common cases, but the guidance is actionable rather than implied.

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