Skip to main content
Glama

alert

Handle native browser dialogs that block page actions: read text, accept or dismiss, or type into a prompt field.

Instructions

Handle a native browser dialog opened by alert(), confirm(), or prompt(). While one is open, other page actions fail until it is handled. get_text reads the message; accept clicks OK and dismiss clicks Cancel, which close the dialog and let the page act on the answer (this cannot be undone); send_text types into a prompt() before you accept it. Every action returns the dialog's text. Fails if no dialog is open. Custom in-page modals are not native dialogs: use click on their buttons instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNoFor send_text: the text to type into the prompt() field. Ignored for other actions.
actionYesget_text = read the message; accept = OK; dismiss = Cancel; send_text = type into a prompt() (then accept).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.3.0
    • addedInput schema / properties / action / description
      Added value: +"get_text = read the message; accept = OK; dismiss = Cancel; send_text = type into a prompt() (then accept)."
    • addedInput schema / properties / text / description
      Added value: +"For send_text: the text to type into the prompt() field. Ignored for other actions."
  2. First observedv0.1.2

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so richly: it discloses the blocking behavior (other page actions fail until handled), that accept/dismiss are irreversible ('this cannot be undone'), that every action returns the dialog's text, and the send_text→accept sequencing. This is exactly the behavioral context an agent needs.

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?

A single dense paragraph that is front-loaded with the purpose before moving to per-action semantics, failure mode, and the sibling distinction. Every sentence carries distinct information with no filler.

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?

Although there is no output schema, the description explicitly states that every action returns the dialog's text, and with no annotations the blocking/irreversibility semantics are fully covered. Nothing an agent needs in order to call this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning beyond the schema by mapping each enum value to an outcome (accept=OK, dismiss=Cancel) and adding the sequencing constraint that send_text types into a prompt() 'before you accept it'. Marginal but real added value over the already-complete schema.

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 (Handle) and a precisely scoped resource (native browser dialog opened by alert(), confirm(), or prompt()), and explicitly distinguishes it from custom in-page modals, which it routes to the click sibling. An agent can identify this tool and its boundary versus siblings without opening any schema.

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?

Gives explicit when-to-use (a native dialog is open, which blocks other page actions), when-not (custom in-page modals are not native dialogs — use click on their buttons), and a failure condition ('Fails if no dialog is open'). Nothing is left to inference.

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