Skip to main content
Glama

Execute Solidworks Script

execute_solidworks_script

Execute custom Python CAD code against the live SolidWorks COM API to build mathematical curves, airfoils, complex lofts, and specialized mechanical geometry.

Instructions

Executes custom Python CAD code directly against the live SolidWorks COM API. Variables available in scope: swApp, model, part, sketch_mgr, feat_mgr, sel_mgr, ext, mm_to_m, m_to_mm, math. Ideal for custom mathematical curves, airfoils, complex lofting, or specialized mechanical geometry.

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": {
      "python_code": "<python_code>"
    },
    "name": "execute_solidworks_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
python_codeYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses that code runs 'directly against the live SolidWorks COM API' and lists the in-scope variables, which implies mutation of the open model, but it says nothing about what happens on exceptions, whether a model must already be open, transaction/undo behavior, or destructive risk from arbitrary code.

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?

Two sentences, front-loaded with the action and followed by the environment details an agent needs to write a valid snippet. No filler or redundant restatement of the title.

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

Completeness3/5

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

The presence of an output schema means return values need not be explained, and the scoped-variable list is the key missing context for a code-execution tool. However, with zero annotations, the description leaves a significant gap around failure modes, preconditions (model open, connection state), and side-effect safety that an agent needs before running arbitrary code.

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 0% for the single python_code parameter, but the description compensates meaningfully by enumerating the injected globals (swApp, model, part, sketch_mgr, feat_mgr, sel_mgr, ext, mm_to_m, m_to_mm, math) that determine how the code must be written. It does not state expected return/result conventions for the snippet itself.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and mechanism: it executes custom Python CAD code against the live SolidWorks COM API. That clearly separates it from the declarative feature siblings like add_hole_to_part or feature_fillet, though no sibling is named explicitly.

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?

'Ideal for custom mathematical curves, airfoils, complex lofting, or specialized mechanical geometry' gives concrete conditions for reaching for this escape-hatch tool over the built-in feature tools. It stops short of saying when NOT to use it or naming a specific alternative for simple geometry.

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