Skip to main content
Glama

browser_handle_dialog

Handle JavaScript alert, confirm, or prompt dialogs on the active tab by setting the desired action before the dialog appears, preventing tab freeze.

Instructions

Arm automatic handling of the next JavaScript alert/confirm/prompt on the active tab, then return immediately. Call this BEFORE the click that opens the dialog - a dialog freezes the tab, so nothing can be clicked once it is on screen. Pass wait=true only when the dialog is already opening.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNoText to enter for prompt() dialogs
waitNoBlock until a dialog appears instead of arming and returning (default: false). Only use when the dialog is already on its way.
actionNoAccept or dismiss the dialog (default: accept)
timeoutNoHow long the arming stays active in ms (default: 60000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.28.0
    • changedInput schema / properties / timeout / description
      Previous value: -"Max wait for dialog in ms (default: 10000)"New value: +"How long the arming stays active in ms (default: 60000)"
    • addedInput schema / properties / wait
      Added value: +{
      +  "description": "Block until a dialog appears instead of arming and returning (default: false). Only use when the dialog is already on its way.",
      +  "type": "boolean"
      +}
  2. First observedv1.0.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 behavior-disclosure burden. It discloses the arming-then-returning mode, the blocking wait mode, and the tab-freeze rationale. It does not state what happens if no dialog appears before timeout or whether a result is returned, but these are minor for this tool.

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?

Two sentences, front-loaded with the core operation and followed by high-value timing guidance. No filler or repetition of schema details.

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 small, well-schematized tool, the description is largely complete: it explains what 'arm' means, the required call order, and the wait mode. Minor omissions—no-dialog timeout behavior and return value—keep it from a 5.

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?

The input schema already covers all 4 parameters with 100% description coverage, so the baseline is 3. The description adds a useful temporal constraint for wait (only when the dialog is already opening) but does not materially expand on text, action, or timeout 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 uses a specific verb ('Arm...') and identifies the exact resource (next JavaScript alert/confirm/prompt on the active tab). It also states the immediate-return behavior, making it clearly distinct from sibling browser tools like browser_click or browser_ask_user.

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 sequencing guidance: call before the click that opens the dialog, because the dialog freezes the tab and prevents further clicks. It also restricts wait=true to the case where the dialog is already opening, which is a clear when-not condition.

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