Skip to main content
Glama

handle_dialog

Accepts or dismisses JavaScript dialogs (alert, confirm, prompt, beforeunload) open on a browser tab so page-code tools can run again. Returns the dialog and acceptance state.

Instructions

Accepts or dismisses the JavaScript dialog (alert, confirm, prompt, beforeunload) open on the tab. While one is open, tools that run page code fail naming it. Returns {accepted, dialog}; fails when none is open.

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

Input Schema

NameRequiredDescriptionDefault
acceptYestrue = OK / Leave, false = Cancel / Stay.
tab_idNoDefault: the active tab.
instance_idNoDefault: 'default'.
prompt_textNoAnswer to a prompt when accepting it. Default: its default answer.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0-rc.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does reasonably well: it discloses the blocking interaction with page-code tools, the return shape {accepted, dialog} despite no output schema, and the failure mode when no dialog is present. It stops short of saying how beforeunload dialogs behave (browsers often restrict these) or what the returned dialog object contains.

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?

Three short sentences, each doing distinct work: what it does, why it matters, and what it returns/fails on. The action and blocking rationale are front-loaded with no redundant phrasing.

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

Completeness4/5

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

For a four-parameter, no-output-schema tool, the description covers the return shape, the failure condition, and the interlock with other tools, which is nearly everything needed to invoke it correctly. The remaining gap is edge-case behavior for beforeunload dialogs, which an agent might reasonably need to know.

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 description coverage is 100%, and the schema already spells out accept (true = OK / Leave, false = Cancel / Stay), tab_id, instance_id, and prompt_text with defaults. The description adds no parameter-level meaning beyond calling out that a prompt answer may be supplied, so the baseline 3 applies.

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?

States a specific verb pair (accepts or dismisses) and a specific resource (the JavaScript dialog open on the tab), and enumerates the dialog types it covers (alert, confirm, prompt, beforeunload). An agent knows exactly what operation this performs 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 Guidelines4/5

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

Gives a clear trigger condition — 'while one is open, tools that run page code fail naming it' — which tells the agent when this tool is the remedy, and a negative condition, 'fails when none is open', which discourages speculative calls. It does not name a sibling alternative, but no sibling in the catalog handles dialogs, so there is nothing to route against.

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