Skip to main content
Glama

browser_handle_dialog

Answer JavaScript dialogs (alert, confirm, prompt, or leave-site) on the active tab. Arm automatic handling before a click that opens one, or answer an existing dialog now.

Instructions

Answer a JavaScript alert/confirm/prompt or "Leave site?" on the active tab. If a dialog this extension saw open is on screen and nobody is answering it, it is answered now, and the reply says what Chrome reports happened (action accept or dismiss). Otherwise this arms automatic handling of the next dialog on the tab and returns immediately - call it BEFORE the click that opens the dialog, because a dialog freezes the tab. Pass wait=true only when the dialog is already opening. Errors: dialog-being-answered (browser_navigate or an earlier call is answering it - wait), dialog-unconfirmed (answered, but Chrome did not confirm it closed), tab-not-responding (a dialog that opened before anything listened, or a busy page; the note says what to do).

Input 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.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it explains the arming vs. immediate-answer behavior, why timing matters (tab freeze), what the reply reports, and a named error taxonomy (dialog-being-answered, dialog-unconfirmed, tab-not-responding) with remediation for each.

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?

It is one dense paragraph but front-loaded: the core action comes first, then the arming/timing rule, then errors. Nearly every clause earns its place, though the error enumeration could be tightened slightly.

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 tool with no annotations and no output schema, the description covers both success paths, the reply contents, and all failure modes with remediation. Nothing an agent needs to invoke it 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?

Schema description coverage is 100%, so all four parameters are already documented. The description's 'Pass wait=true only when the dialog is already opening' largely restates the schema's own wait guidance and adds the action outcome, giving baseline value without new syntax or format detail.

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 and resource (answer JavaScript alert/confirm/prompt or 'Leave site?' on the active tab), which cleanly distinguishes it from siblings like browser_dismiss_overlays or browser_click. An agent can tell immediately what this tool acts on.

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?

Gives explicit when/when-not guidance: call it BEFORE the click that opens the dialog because a dialog freezes the tab, and pass wait=true only when the dialog is already opening. It also names alternative outcomes (if a dialog is on screen it is answered now) so the agent knows both paths.

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