Skip to main content
Glama

close_window

Closes a Windows window safely by sending WM_CLOSE only after verifying it still matches the expected title and process, preventing accidental closure of a changed window.

Instructions

Close a window safely (WM_CLOSE after verification — never blind Alt+F4). Pass expect_title/expect_process to refuse (409) if the window changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hwndYes
expect_titleNo
expect_processNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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?

With no annotations, the description carries the behavioral burden and does a good job: it discloses the safe close mechanism, the verification step, and the 409 refusal condition. It could further clarify what 'verification' checks exactly and what success/failure responses look like, but the core behavior is transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact, front-loaded, and every sentence earns its place: the first sentence states the action and mechanism, the second explains the safety parameters. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 3-parameter tool with an output schema, the description is nearly complete: it covers the action, the safe method, and the guard parameters. Minor gaps include not stating what happens when no expect_* params are passed or how success is indicated, but these are acceptable given the low complexity.

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 description coverage is 0%, so the description must compensate. It explains the purpose of expect_title and expect_process (safety guards that trigger a 409 on window change), adding real meaning beyond the schema. hwnd is not described, but its role as a window handle is reasonably inferable from the tool name and 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?

The description states a specific verb and resource ('Close a window safely') and provides the exact mechanism (WM_CLOSE after verification, never blind Alt+F4), which clearly distinguishes it from sibling tools like window_post or keyboard-based closing.

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?

The description gives actionable usage guidance: pass expect_title/expect_process to refuse if the window changed, and explicitly warns against blind Alt+F4. It does not name alternative tools or state when not to use this tool, but the context is clear enough for an agent to recognize when to invoke it.

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