Skip to main content
Glama
SolidWorks MCP Python

SolidWorks MCP Python

by locense

Generate VBA: File Operations

generate_vba_file_operations
Read-onlyIdempotent

Generates VBA macro code to set a custom property across every configuration or run Pack and Go on the active SolidWorks document, returning ready-to-paste code for the VBA editor.

Instructions

Write a VBA macro that sets a custom property in every configuration, or runs Pack and Go on the active document.

To set a property directly, use set_custom_property; for Pack and Go, use pack_and_go_assembly. 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_file_operations"
  }
}

Input Schema

NameRequiredDescriptionDefault
input_dataYesA mapping with `operation`: "custom_properties" (the default, with `property_name` and `property_value`) or "pack_and_go" (with `target_folder`). Any other operation is refused.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/idempotent/non-destructive annotations, it discloses the key behavioral fact that nothing runs in SolidWorks and that the artifact is returned as text for the VBA editor (Alt+F11), plus the critical incompatibility with `execute_macro`. It also names the returned fields, so an agent knows the output is code, not a completed operation.

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?

The core capability is front-loaded in the first sentence, followed by alternatives and execution caveats in a tight block. The trailing 'Returns:' line overlaps with the output schema, but it is short and lets the agent skip a schema lookup, so waste is minimal.

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 one-parameter code-generation tool with full schema coverage and an output schema, this covers everything needed: what is generated, how it must be consumed, what it does not do, and which siblings to prefer. Nothing required for correct invocation 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 a nuance the schema does not: the custom-property branch applies to every configuration, which materially shapes how the agent should frame the request. It doesn't add format detail for `target_folder` or `property_value`, so it stops short of a 5.

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: it writes a VBA macro that either sets a custom property in every configuration or runs Pack and Go on the active document. That immediately separates it from siblings that perform the underlying operations, and the scope (all configurations, active document) is explicit.

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 the agent: use `set_custom_property` to set a property directly and `pack_and_go_assembly` for Pack and Go, and warns that `execute_macro` only runs binary .swp files so it cannot execute this output. When-to-use and when-not-to-use are both covered with named alternatives.

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