Answer JavaScript dialog
browser_handle_dialogAccept or dismiss JavaScript alert, confirm, and prompt dialogs open in an agent tab, optionally entering prompt text, so paused browser pages can continue.
Instructions
Answer the JavaScript dialog (alert, confirm, prompt or leave-page) open in one of the agent's tabs. While one is open the page is paused: browser_snapshot shows the dialog's type, message and dialog_id instead of the page, and other browser commands on the tab say a dialog is open. accept presses OK and dismiss presses Cancel. prompt_text is entered into a prompt before accepting it; without it, a prompt is accepted with its default text. Pass the dialog_id from the snapshot, so a dialog that replaced the one you read is refused instead of answered. Works on a background tab without showing it or using the keyboard. A dialog that opened before the agent attached to the tab cannot be seen or answered; the user answers that one in Chrome. Accepting a confirm can submit, delete or leave a page with unsaved changes, so read the message, and ask the user before confirming anything irreversible.
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": {
"tab_id": "<tab_id>",
"action": "<action>"
},
"name": "browser_handle_dialog"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | accept (OK) or dismiss (Cancel) | |
| tab_id | Yes | tab_id of one of the agent's tabs, from browser_open_tab or browser_list_tabs | |
| dialog_id | No | dialog_id of the dialog being answered, from browser_snapshot (such as d3). A different dialog open now is refused instead of answered | |
| session_id | No | Stable task or thread ID. Pass the same value on every browser call for this task. Different IDs isolate tabs and cleanup within one MCP process. Omit for the default process session. | |
| prompt_text | No | Text to enter into a prompt dialog before accepting it. Only with action=accept on a prompt |