Skip to main content
Glama

browser_handle_dialog

Destructive

Accept or dismiss JavaScript alert, confirm, prompt, or beforeunload dialogs in a specified tab, optionally supplying prompt text.

Instructions

Answers the JavaScript dialog (alert, confirm, prompt, beforeunload) open in tab tab_id (never another tab's dialog).

No dialog is ever accepted automatically: when a command opens one, its response reports it (dialog / pendingDialogs fields: type and message, for the targeted tab only). Read the message, then choose:

  • accept=True: OK / Leave page; accept=False: Cancel / Stay.

  • prompt_text: text entered in a prompt dialog before accepting.

Input Schema

NameRequiredDescriptionDefault
acceptYes
tab_idYesYour tab's id (from browser_new_tab, or a tab adopted with browser_adopt_tab).
prompt_textNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.31.6
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "title": "Result",
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "browser_handle_dialogOutput",
      -  "type": "object"
      -}New value: +null
  2. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

Beyond the annotations (destructive, non-idempotent, openWorld), the description discloses the key non-obvious behavior: no dialog is ever auto-accepted, pending dialogs surface in command responses with type and message, and only the targeted tab's dialog is reported. It also maps accept=True/False to the concrete buttons (OK/Leave page vs Cancel/Stay), which is exactly the context the destructiveHint alone does not convey.

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?

Front-loaded with the one-line purpose, then the blocking behavior, then a compact bullet list for the two decision inputs. Nearly every clause carries operational information; only the parenthetical repetition about tab scoping is slightly redundant.

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?

No output schema exists, and the description covers the return-side behavior by naming the dialog / pendingDialogs fields and their contents (type, message). Combined with the button mapping and tab scoping, an agent has everything needed to call it correctly; only an error case for 'no dialog present' is omitted, which is a minor gap.

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 only 33% (only tab_id is documented), so the description has to compensate. It does: accept is explained as OK/Leave page vs Cancel/Stay, and prompt_text as the text entered in a prompt before accepting, which is meaning the bare boolean/string schema cannot supply.

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 ('Answers') and resource ('the JavaScript dialog'), enumerates the dialog kinds it covers (alert, confirm, prompt, beforeunload), and scopes it to the dialog belonging to tab_id. An agent can distinguish this from siblings like browser_click or browser_wait_for 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?

It gives the explicit trigger condition: dialogs are never auto-accepted, and when a command opens one the response reports it in the dialog / pendingDialogs fields. It then tells the agent to read the message and choose, so the decision procedure is not left to inference.

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