Skip to main content
Glama
SolidWorks MCP Python

SolidWorks MCP Python

by locense

Generate VBA: Batch Export

generate_vba_batch_export
Read-onlyIdempotent

Generates VBA macro code that batch exports every matching SolidWorks file in a folder to STEP copies in a target folder, with optional recursion and exclusion lists. Returns code to paste into the VBA editor.

Instructions

Write a VBA macro that opens every matching file in a folder and saves a STEP copy of each to another folder.

To export one file directly, use export_step. The macro comes back as text for the SolidWorks VBA editor (Alt+F11); execute_macro runs only binary .swp files, so it can't run this directly. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the parameters used and usage_instructions.

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": {
      "input_data": "<input_data>"
    },
    "name": "generate_vba_batch_export"
  }
}

Input Schema

NameRequiredDescriptionDefault
input_dataYesThe batch. Give `operation_type` (e.g. "export"), `file_pattern` (e.g. "*.sldprt"), `source_folder` and `target_folder`; `recursive` defaults to on.

Output Schema

NameRequiredDescriptionDefault

No arguments

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?

Annotations already declare readOnly/idempotent/non-destructive, and the description reinforces this while adding genuinely new behavior: nothing executes inside SolidWorks and the output is code text that cannot be fed to execute_macro. It does not discuss macro limitations or what happens when no files match, which keeps it below a 5.

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?

Purpose is front-loaded, followed by the alternative and the execution constraint. The closing 'Returns:' sentence duplicates the existing output schema, and 'Read-only. Nothing runs in SolidWorks.' partly restates the annotations, so a couple of lines are not fully earning their place.

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?

For a code-generation tool with a nested parameter object and an output schema, the description supplies everything an agent needs: what is produced, that it is inert text, how to consume it, and which sibling handles the direct-export case.

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 coverage is 100%, so the schema already documents each field including defaults. The description adds usage-level guidance (give operation_type, file_pattern, source_folder, target_folder; recursive defaults on) but does not resolve the alias duplication of source_directory vs source_folder or export_format vs operation_type.

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 (write a VBA macro), the exact scope (opens every matching file in a folder, saves a STEP copy to another folder), and names the sibling it is not (export_step). The agent can distinguish it from batch_export and generate_vba_file_operations 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 Guidelines5/5

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

Explicitly routes single-file work to export_step and explains that the artifact is source text for the SolidWorks VBA editor (Alt+F11), not a runnable module, because execute_macro only accepts binary .swp files. Both when-to-use and when-not-to-use are covered.

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

Deploy Server

Other Tools