Skip to main content
Glama

Auto-handle JS dialogs (alert/confirm/prompt)

dialog

Arm a tab to auto-handle and capture native JavaScript pop-ups so pages do not freeze or block the browser connection; retrieve captured pop-ups or stop handling when done.

Instructions

Native JS dialogs freeze the page and wedge the whole connection. Opt-in per tab: 'arm' (behavior 'dismiss' (default) or 'accept'; optional promptText for prompt()) makes future dialogs on that tab auto-handle + get captured; 'get' returns captured dialogs; 'disarm' stops. Arm BEFORE an action that may trigger a dialog. Default 'dismiss' never auto-confirms destructive dialogs.

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": {
      "action": "<action>",
      "tabId": "<tabId>"
    },
    "name": "dialog"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabIdYesTarget tab ID (must be in the MCP group)
actionYesarm / disarm / get
behaviorNoOn arm: accept or dismiss (default dismiss)
promptTextNoText to submit for prompt() dialogs when accepting

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.24.1

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it explains the consequence of not acting (page freeze, wedged connection), that armed dialogs are captured and retrievable, and that the default 'dismiss' will not auto-confirm destructive dialogs. Gaps remain around lifetime semantics (does arm survive navigation?) and what happens if a dialog fires on an unarmed tab.

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 risk statement is front-loaded and every sentence carries operational meaning. The nested parenthetical for arm options makes it slightly dense to parse, but nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The action semantics are covered well, but with no output schema, the description should say what 'get' actually returns (shape and whether retrieval clears the buffer). That is the one thing an agent needs to call 'get' correctly and it is absent.

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%, so the enum values, default behavior, and promptText are already documented in the schema. The description adds modest value by tying promptText specifically to prompt() dialogs when accepting, but mostly restates what the schema declares.

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 names the exact resource (native JS alert/confirm/prompt dialogs) and the three operations (arm/disarm/get) with per-tab scoping. No sibling in the list handles JS dialogs, and the description makes that niche unmistakable without needing to contrast names.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit ordering guidance ('Arm BEFORE an action that may trigger a dialog') and frames the tool as opt-in per tab, which tells the agent when to reach for it. It stops short of naming an alternative or a when-not condition, but there is no obvious competing tool for this job.

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