Skip to main content
Glama

add_global_variable

Add a named global variable equation in SolidWorks, allowing sketch and feature dimensions to reference parameters like A, B, C for parametric parts without rebuilding.

Instructions

Agregar variable global (ecuación) — declara un parámetro nombrado como "A", "B", "C" que las dimensiones de croquis y de feature pueden referenciar mediante una ecuación. Requisito habitual para piezas paramétricas como el CSWA Tool Block donde A, B, C deben modificarse entre pasos sin reconstruir.

[en: Add a global variable (equation) — declare a named parameter like "A", "B", "C" that sketch and feature dimensions can reference via an equation. Standard requirement for parametric parts like the CSWA Tool Block where A, B, C must change across steps without rebuilding.]

Args: name: Variable name (LHS of the equation). Cannot contain quotes, =, comma, or @. SW convention: short uppercase, e.g. "A", "B". value: The numeric value in the specified units. units: "mm" (default, length), "deg" (angle), or "raw" (dimensionless). SW stores values internally as meters / radians; this argument controls the equation suffix and the internal conversion.

Returns dict with: name, value, units, equation (raw SW string like '"A" = 81mm'), index (0-based position in the equation table).

Binding a dim to this variable: after creating the global, ADD ANOTHER EQUATION whose LHS is the dim name and whose RHS is the variable: add_global_variable("D1@Croquis1", '"A"', units="raw") (Pass an expression string; the equation manager accepts dim-paths on the LHS in addition to variable names.)

To change the value later, use set_global_variable. Do NOT call add_global_variable again with the same name.

Related: set_global_variable (modify existing), modify_dimension (feature dims only, not global vars).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
unitsNomm
valueYes
Behavior5/5

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

With no annotations, the description carries full burden and excels: discloses that units control equation suffix and internal conversion, describes return dict fields, explains raw SW string format, and warns about reuse. No contradictions.

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?

Well-structured with clear sections (purpose, args, returns, binding example, related). Contains dual-language text (Spanish/English) which adds some redundancy but remains efficient overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity and no output schema, the description covers all needed context: how to use, what it returns, how to bind dimensions, unit behavior, and concrete example. Complements sibling tools effectively.

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

Parameters5/5

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

Despite 0% schema description coverage, the description adds comprehensive meaning: name restrictions (no quotes, =, comma, @) and convention, value numeric, units with allowed values and conversion details. Far exceeds schema minimal info.

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 clearly states it adds a global variable (equation) that sketch and feature dimensions can reference. It distinguishes from related tools by explicitly naming set_global_variable and modify_dimension as alternatives, and warns against reusing the same name.

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

Usage Guidelines5/5

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

Provides explicit when-to-use context (parametric parts like CSWA Tool Block) and when-not-to-use (do not call again for same variable). Explains how to bind dimensions by adding another equation and lists related tools for modification.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/danielproxd2/MCP_CAD'

If you have feedback or need assistance with the MCP directory API, please join our Discord server