Skip to main content
Glama
Browser Session MCP

Browser Session MCP

close_browser_session

DestructiveIdempotent

Permanently closes a browser session and removes all its tabs, cookies, storage, and logs. Use it when the task is finished so the session does not remain open.

Instructions

Close a browser session for good: closes all its tabs, discards its cookies and storage, and deletes its console and network logs and saved .cpuprofile files. Call it when the task is done so the session doesn't sit open until the reaper closes it, but leave a session open while its login may be needed again soon. Use close_tab instead to close one tab and keep the session. A session opened with a name saves its login under the name first; otherwise save_browser_state first if the login should outlive the session. Idempotent: closing an unknown or already-closed session succeeds, so it is safe in cleanup code. Returns a confirmation.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sessionId": "<sessionId>"
    },
    "name": "close_browser_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
sessionIdYesThe id returned by open_browser_session. An unknown or already-closed id succeeds without error.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.4
    • changedInput schema / properties / sessionId / description
      Previous value: -"The id returned by open_browser_session. Errors if no open session has it."New value: +"The id returned by open_browser_session. An unknown or already-closed id succeeds without error."
  2. Changed1 schema field changed
    • addedInput schema / properties / sessionId / description
      Added value: +"The id returned by open_browser_session. Errors if no open session has it."
  3. First observedv0.1.2

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already carry destructiveHint=true and idempotentHint=true, but the description adds material detail beyond them: which artifacts are lost (cookies, storage, logs, .cpuprofile), the interaction with named login persistence, and the pre-condition of calling save_browser_state. It also states the return value ("Returns a confirmation").

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 destructive scope is front-loaded in the first sentence and each following clause carries a distinct decision (timing, tab-level alternative, login persistence, safety in cleanup code). It is dense but long, and the closing idempotency remark duplicates the schema text.

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 single-parameter tool with no output schema, the description covers destruction scope, timing trade-offs, alternatives, state-saving prerequisites, idempotency, and the return value. Nothing an agent needs to decide or call correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is a single parameter and schema description coverage is 100%, with the schema already documenting that an unknown or already-closed id succeeds. The description repeats that idempotency note rather than adding syntax or format detail, so it neither compensates for a gap nor clarifies much beyond the 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 opens with a specific verb and resource ("Close a browser session for good") and immediately enumerates what is destroyed: tabs, cookies, storage, console and network logs, and .cpuprofile files. That scope statement distinguishes it cleanly from the sibling close_tab, which the description itself names.

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?

It gives explicit when-to-use ("Call it when the task is done so the session doesn't sit open"), an explicit when-not ("leave a session open while its login may be needed again soon"), and a named alternative with its own condition ("Use close_tab instead to close one tab and keep the session").

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