Skip to main content
Glama

handle_dialog

Set up a handler for JavaScript dialogs (alert, confirm, prompt) to accept or dismiss them before they block the page. Provide the session ID and action; optionally enter prompt text.

Instructions

Arm a one-shot handler for the NEXT JavaScript dialog (alert/confirm/prompt) on a session — accept or dismiss, with optional prompt text. Returns {success}. Must be called BEFORE the action that triggers the dialog, otherwise the dialog blocks the page and times out.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAccept or dismiss the dialog
session_idYesSession ID
prompt_textNoText to enter for prompt() dialogs (optional)
Behavior4/5

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

Discloses one-shot nature, return format, and timing requirement. Lacks info on multiple calls or no-dialog scenario, but no annotations to contradict.

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 concise sentences, front-loaded with core action. Every sentence adds value without redundancy.

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?

Covers purpose, usage timing, and return. Minor gaps on edge cases (e.g., handler expiration, no dialog) but acceptable given tool simplicity and no output schema.

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 covers all parameters with descriptions (100% coverage). Description adds context on prompt_text purpose but no new parameter-level details beyond 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?

Description clearly states it arms a one-shot handler for JavaScript dialogs, specifying actions (accept/dismiss) and optional prompt text. Unique among sibling tools.

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?

Explicitly states must be called BEFORE the dialog-triggering action, with a consequence if not. Does not specify alternatives, but no sibling tools handle dialogs.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/segentic-lab/periscope-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server