Skip to main content
Glama

close_instance

Destructive

Terminate a sandboxed instance by killing its app and Xephyr display, then verify it has stopped. Use all_launched to close every instance launched by this server.

Instructions

Close an instance: kill its app + its Xephyr display, and verify it actually went down.

Returns {"ok", "instance", "detail"} only after the display stops responding. With all_launched=true closes EVERY instance this server process launched (instance is ignored) and returns {"ok", "closed": [...], "failed": [...]} — "ok" is false if any survived. Fails (isError) if the instance isn't running, if it survives SIGTERM, or for instance 1 — the main start-display.sh sandbox is protected (stop it from the host with pkill Xephyr). Closing an instance another agent launched is allowed but visible to it (launched_here).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "close_instance"
  }
}

Input Schema

NameRequiredDescriptionDefault
instanceNo
all_launchedNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.6.1
    • addedInput schema / properties / all_launched
      Added value: +{
      +  "default": false,
      +  "title": "All Launched",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / instance / default
      Added value: +0
    • removedInput schema / required
      Removed value: -[
      -  "instance"
      -]
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already flag destructive/openWorld/not-readOnly, but the description adds what actually gets destroyed (app plus Xephyr display), that it waits for the display to stop responding, the two distinct return shapes, and the isError conditions (not running, survives SIGTERM, instance 1 protected). It also discloses a cross-agent side effect — closing another agent's instance is allowed but visible to it via launched_here — which no annotation conveys.

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 action and its verification are front-loaded, then the bulk return mode, then failure cases — a sensible order. It is dense and parenthetical-heavy, but nearly every clause carries information an agent needs; only the return-shape enumeration is somewhat redundant with the output schema.

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 destructive tool with an output schema and full annotation coverage, the description covers destruction scope, verification, failure modes, and cross-agent effects. The only meaningful omission is the semantics of the default instance value, which matters for a zero-required-parameter call.

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 0%, so the description must carry the load, and it does: all_launched=true is defined as closing every instance launched by this server process and explicitly makes instance irrelevant. The one gap is the default instance=0 — the description never says what 0 means or whether it selects a default instance.

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 opening clause gives a specific verb and resource plus the mechanism: 'Close an instance: kill its app + its Xephyr display, and verify it actually went down.' That distinguishes it from siblings like launch_app, list_instances, and status without the agent needing to open a schema.

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 clearly routes between the two modes — a single instance by default, versus all_launched=true which ignores instance and closes everything this server process launched. It also gives the fallback path for the protected instance 1 (stop it from the host with `pkill Xephyr`). No explicit alternative sibling tool is named for inspecting instances first, so it stops short of full when-not guidance.

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