Skip to main content
Glama

close_active_document

Close the active SolidWorks document to prevent file collisions in iterative build/save/rebuild flows. Blocks close if unsaved changes, unless force=True is specified.

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:\Users\danie\OneDrive\Escritorio\flecha.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 fully bears the burden. It discloses default behavior (refuses dirty docs), force behavior (silent discard), underlying API verbs (CloseDoc vs QuitDoc), return dict fields, raised errors, and an example. This is 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?

The description is well-structured with Args, Returns, Raises, and Examples sections. It is slightly verbose due to bilingual (Spanish/English) content, but every sentence adds value. The English part alone is clear and 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, the description covers return fields, errors, parameter semantics, and examples. It fully explains behavior, prerequisites, and edge cases, making it complete for an agent to use correctly.

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_description_coverage is 0%, so the description must compensate. It explains the single 'force' parameter in detail: default false raises error if dirty, true discards changes. It also warns about using force only when doc is disposable and notes the underlying API distinction.

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 the tool closes the active SolidWorks document, with a specific verb and resource. It distinguishes from siblings by contextualizing its role in iterative build/save/close flows, contrasting with save_as failure when windows pile up.

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 describes when to use: in iterative build/save/close flows. Provides default behavior (refuses if dirty) and force=True usage with a warning. Includes an example flow showing canonical usage and a force-close example, offering clear guidance.

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