Skip to main content
Glama
danielproxd2

MCP_CAD

by danielproxd2

close_active_document

Closes the active SolidWorks document to prevent file collisions; defaults to error on unsaved changes unless force discards them.

Instructions

Cerrar el documento activo en SolidWorks.

Útil para flujos iterativos (build → save_as → close → new_part → rebuild) que de otra manera dejan ventanas viejas abiertas y hacen que save_as falle por colisión de archivo. Por defecto exige que el documento esté guardado; pasa force=True para descartar cambios sin aviso. [en: Close the active document in SolidWorks. Used in iterative build/save/rebuild flows that otherwise pile up open windows and make save_as collide on the open file. Default refuses to close a dirty doc; force=True discards unsaved changes silently.]

Args: force: False (default) raises if the active document has unsaved changes. True silently discards them — use ONLY when the doc is disposable (e.g., rebuilding from scratch). Distinct verbs under the hood: ISldWorks.CloseDoc for clean docs, ISldWorks.QuitDoc for force-discards.

Returns dict: closed: True if the close succeeded. name: The document title at the time of close (trailing '*' stripped if present). was_modified: Whether the document had unsaved changes at the moment of close (== True only when force=True was needed).

Raises: - SolidWorksError if no active document. - SolidWorksError if the document was dirty and force=False.

Example — canonical iterative-rebuild flow: save_as(r"C:\CAD\output\shaft.SLDPRT") close_active_document() # default: errors if unsaved new_part() # fresh blank # ... rebuild geometry ...

Example — force-close a throwaway probe: close_active_document(force=True)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNo
Behavior5/5

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

No annotations provided, so description carries full burden. Explains default behavior (refuses dirty doc) and force behavior (discards unsaved changes), underlying verb distinction (CloseDoc vs QuitDoc), return dict fields (closed, name, was_modified), and error conditions. Highly transparent.

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 sections (Args, Returns, Raises, Examples) and front-loaded purpose. However, includes both English and Spanish translations which may be slightly redundant. Generally clear but could be more concise.

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 no output schema, description covers return dict and errors. Provides examples, explains error conditions, and gives canonical use cases. Complete for a simple tool with one parameter.

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?

Schema has 0% description coverage (no param descriptions), so description must add meaning. It does: explains default (False) raises error if dirty, True silently discards, with use case (throwaway doc). Adds significant value beyond schema.

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?

Description uses specific verb 'Close' and resource 'active document in SolidWorks', with additional context about its role in iterative workflows. Clearly distinguishes from siblings like save_as and open_document.

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?

Explicitly describes when to use (iterative build→save_as→close→new_part→rebuild flows) and why (prevents window pile-up and save_as collisions). Mentions default vs force behavior but doesn't explicitly state when not to use.

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/solidworks-mcp'

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