Skip to main content
Glama
andresolbach

nodriver-mcp-server

Handle JavaScript dialog

handle_dialog

Resolve JavaScript alert, confirm, or prompt dialogs that block page operations. Accept or dismiss the dialog, with optional text for prompt() dialogs, to unblock automation.

Instructions

Answer an open JavaScript dialog — alert, confirm or prompt.

A dialog blocks the page and every subsequent tool call until it is handled, so call this as soon as one appears. Returns an error if no dialog is open.

beforeunload dialogs triggered by navigating away are handled automatically via navigate_page's handle_before_unload parameter; this tool is for dialogs the page opens by itself.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoAccept (OK) or dismiss (Cancel) the dialog. Either closes an alert(); for confirm() the choice is what the page's JavaScript receives.accept
prompt_textNoText to enter into a prompt() dialog before accepting it. Ignored for alert() and confirm() dialogs.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

The description discloses important behavior beyond annotations: the blocking nature of dialogs, the error when no dialog is open, and the distinction from automatically handled beforeunload dialogs. No contradiction with annotations.

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?

Four concise sentences, each adding unique value: purpose, blocking behavior, error condition, and distinction from navigation dialogs. Front-loaded with the core purpose.

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 simple 2-parameter schema and provided annotations, the description covers all necessary context: when to use, behavior, error handling, and how it relates to other tools. Output schema exists, so return values need no explanation.

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 coverage is 100% with parameter descriptions already explaining accept/dismiss and prompt_text. The description does not add further meaning to the parameters themselves, meeting the baseline for high schema coverage.

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 'Answer' and resource 'open JavaScript dialog', explicitly listing the dialog types: alert, confirm or prompt. It clearly distinguishes from sibling tools, none of which are dialog-related.

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 explicitly states when to use: 'A dialog blocks the page and every subsequent tool call until it is handled, so call this as soon as one appears.' It also gives an exclusion: beforeunload dialogs are handled by navigate_page, so this tool is for dialogs the page opens by itself.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andresolbach/nodriver-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server