Skip to main content
Glama

Handle JavaScript dialog

browser_handle_dialog
Destructive

Accept or dismiss the JavaScript dialog that is pending on the shared tab. action is accept or dismiss. promptText (max 2000 characters) is sent only when accepting a prompt; on alert or confirm it is ignored and the result includes a warning. With no pending dialog the call returns NO_DIALOG. Two calls at once: the first resolves the dialog and the other returns NO_DIALOG. If nothing resolves the dialog within 30s it is dismissed and History records Dismissed a dialog (timeout). Uses Page.javascriptDialogOpening and Page.handleJavaScriptDialog. Does not click, type, or capture the page.

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": "browser_handle_dialog"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionNo
sessionIdYes
promptTextNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

It provides critical behavioral context missing from annotations and schema, including the 30s timeout mechanism, the reporting of NO_DIALOG, and specific operational constraints (e.g., does not click or capture).

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 description is highly detailed and necessary due to the tool's complex timing and failure modes; while long, every sentence provides indispensable information.

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?

Given the complexity of handling asynchronous dialog states, the description is perfectly complete, covering execution scope, concurrency, and timeout behavior.

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?

Since schema coverage is 0%, the description effectively defines the semantics of every parameter, particularly clarifying that promptText is only utilized during an 'accept' action and is ignored otherwise.

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 explicitly states the function is to handle/accept or dismiss pending JavaScript dialog, clearly distinguishing it from simple clicking or navigation tools in the sibling list.

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 provides detailed usage instructions, such as explaining when promptText is relevant (only when accepting) and how concurrent calls are handled.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.