Skip to main content
Glama

app_close_document

Closes a specific open document by its full path, independent of which tab has focus. Refuses documents with unsaved edits unless changes are explicitly discarded.

Instructions

Close ONE open document, found by its full path, whatever has focus.

Unlike closing through the workspace manager, which acts on the FOCUSED object, this closes the named document itself. It refuses a document that reads modified, and says whether it is really gone afterwards. The modified read can miss edits held in the editor, so save anything you care about first; a close of an edited document may still raise Altium's save prompt.

Args: file_path: the document's full path, as app_list_documents reports it. discard_changes: close it even when it reads modified, and LOSE the unsaved edits: the modified flag is cleared first so no save prompt appears. For scratch copies and documents Altium changed by merely opening them, never for work.

Returns: {"closed": bool, "discarded": bool, "file_path": ...}; an error when the path is not open, or when the document reads modified and discard_changes is not set.

Input Schema

NameRequiredDescriptionDefault
file_pathYes
discard_changesNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the refusal condition, the destructive side effect of discard_changes (flag cleared, edits LOST, no save prompt), the post-condition check ("says whether it is really gone"), and the error cases. The caveat that the modified read can miss in-editor edits and that a save prompt may still appear is exactly the kind of non-obvious behavior an agent needs.

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?

Front-loaded with the key distinction and the destructive warning, and the Args/Returns blocks are readable. The Returns block partially duplicates the existing output schema, though it adds the error conditions, so the slight redundancy is defensible rather than wasteful.

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 destructive, focus-independent document close with a 0%-documented schema and no annotations, the description covers scope, refusal semantics, data-loss risk, error conditions and post-condition reporting. Even though an output schema exists, the description's mention of the error cases adds the missing piece an agent needs.

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 coverage is 0%, so the description must compensate and does: file_path is specified as the full path in the exact form app_list_documents reports it, and discard_changes is given meaning far beyond a boolean default (clears the modified flag first, suppresses the save prompt, loses edits, when it is appropriate).

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 ("Close ONE open document") plus the lookup key ("found by its full path") and the focus-independence ("whatever has focus"). It then explicitly separates itself from the workspace-manager close that acts on the FOCUSED object, so an agent can pick between them without opening either 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?

Names the alternative path (closing via the workspace manager) and the condition that distinguishes it, then gives an explicit when-to-use / when-not-to-use rule for discard_changes: "For scratch copies and documents Altium changed by merely opening them, never for work." Preconditions (refuses a document that reads modified) are stated up front.

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