Skip to main content
Glama

Handle a JavaScript dialog

handle_dialog

Accept or dismiss open browser alert, confirm, prompt, and beforeunload dialogs in a tab, entering text into prompt dialogs before acceptance.

Instructions

Accept or dismiss an open alert/confirm/prompt/beforeunload dialog in a tab. For prompt dialogs, text is entered before accepting.

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

Input Schema

NameRequiredDescriptionDefault
textNoText to enter into a prompt() dialog before accepting.
tabIdYesTab ID from tabs_context / tabs_create.
actionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the dialog types and the ordering constraint that prompt text is entered before accepting, but omits what happens if no dialog is present, whether the call blocks or times out, and whether accepting a beforeunload navigates away or dismiss keeps the page. These are meaningful gaps for a mutation-like browser action.

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?

Two compact sentences, front-loaded with the core action and scope, with the prompt nuance appended second. No filler or redundancy.

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 tool has no output schema and no annotations, so the description must convey everything. It covers the action space well but leaves failure behavior, return information (e.g., prompt result), and blocking semantics undocumented, which is a notable gap for a browser-state-mutating tool.

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 67% (text and tabId documented; the action enum has no description). The description's prompt sentence largely restates the schema's text parameter and does not clarify edge cases such as whether text is ignored for non-prompt dialogs or whether it is required for prompts. Baseline 3 is appropriate given the schema does most of the work.

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 a specific verb pair (accept/dismiss), a specific resource (an open alert/confirm/prompt/beforeunload dialog in a tab), and enumerates the dialog types covered. No sibling tool in the list handles dialogs, so an agent can identify this as the sole entry point for dialog interaction without opening the schema.

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

Usage Guidelines3/5

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

Usage is only implied: the agent must infer that this applies when a dialog is currently blocking a tab. There is no explicit statement of when NOT to use it (e.g., that it fails when no dialog is open), no mention of pairing it with an action that triggers the dialog, and no guidance about beforeunload dialogs specifically despite listing them.

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