Skip to main content
Glama

pilot_dialog

Retrieve captured browser dialog messages (alert, confirm, prompt) from a buffer. Use to inspect dialog text or verify dialog appearance after an action.

Instructions

Retrieve captured browser dialog messages (alert, confirm, prompt) from a circular buffer. Use when the user wants to see what native dialogs appeared on the page, check prompt text, or verify that a dialog was triggered after an action. Note: configure auto-handling with pilot_handle_dialog to prevent dialogs from blocking page interaction.

Parameters:

  • clear: Set to true to clear the buffer after reading

Returns: Timestamped list of dialogs showing type (alert/confirm/prompt), message text, and the action taken (accepted/dismissed) with any response text. Or "(no dialogs captured)" if empty.

Errors: None — returns empty message if no dialogs were captured.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearNoClear the buffer after reading

Implementation Reference

  • The 'pilot_dialog' tool handler: registers the tool with a description and typed 'clear' parameter, reads the dialogBuffer (a CircularBuffer of DialogEntry objects), formats timestamped dialog entries (type, message, action, response), and returns them as text. Supports clearing the buffer.
      server.tool(
        'pilot_dialog',
        `Retrieve captured browser dialog messages (alert, confirm, prompt) from a circular buffer.
    Use when the user wants to see what native dialogs appeared on the page, check prompt text, or verify that a dialog was triggered after an action. Note: configure auto-handling with pilot_handle_dialog to prevent dialogs from blocking page interaction.
    
    Parameters:
    - clear: Set to true to clear the buffer after reading
    
    Returns: Timestamped list of dialogs showing type (alert/confirm/prompt), message text, and the action taken (accepted/dismissed) with any response text. Or "(no dialogs captured)" if empty.
    
    Errors: None — returns empty message if no dialogs were captured.`,
          { clear: z.boolean().optional().describe('Clear the buffer after reading') },
        async ({ clear }) => {
          await bm.ensureBrowser();
          if (clear) { dialogBuffer.clear(); return { content: [{ type: 'text' as const, text: 'Dialog buffer cleared.' }] }; }
          if (dialogBuffer.length === 0) return { content: [{ type: 'text' as const, text: '(no dialogs captured)' }] };
          const text = dialogBuffer.toArray().map(e =>
            `[${new Date(e.timestamp).toISOString()}] [${e.type}] "${e.message}" → ${e.action}${e.response ? ` "${e.response}"` : ''}`
          ).join('\n');
          return { content: [{ type: 'text' as const, text }] };
        }
      );
  • The DialogEntry interface defining the schema for dialog buffer entries: timestamp, type (alert/confirm/prompt), message, optional defaultValue, action (accepted/dismissed), and optional response text.
    export interface DialogEntry {
      timestamp: number;
      type: string;
      message: string;
      defaultValue?: string;
      action: string;
      response?: string;
    }
  • The dialogBuffer singleton and addDialogEntry helper: a CircularBuffer<DialogEntry> with 50,000 entry capacity, used by the tool to store and retrieve captured browser dialogs.
    export const dialogBuffer = new CircularBuffer<DialogEntry>(HIGH_WATER_MARK);
    
    export function addConsoleEntry(entry: LogEntry) {
      consoleBuffer.push(entry);
    }
    
    export function addNetworkEntry(entry: NetworkEntry) {
      networkBuffer.push(entry);
    }
    
    export function addDialogEntry(entry: DialogEntry) {
      dialogBuffer.push(entry);
    }
  • Registration of all tools via registerAllTools, which calls registerInspectionTools (the function that registers 'pilot_dialog'). The tool is not in CORE or STANDARD sets, so it's only available in 'full' profile.
    export function registerAllTools(server: McpServer, bm: BrowserManager, profile: ToolProfile = 'full'): void {
      const allowed = PROFILE_TOOLS[profile];
      const effectiveServer = allowed ? createFilteredServer(server, allowed) : server;
    
      registerNavigationTools(effectiveServer, bm);
      registerSnapshotTools(effectiveServer, bm);
      registerInteractionTools(effectiveServer, bm);
      registerPageTools(effectiveServer, bm);
      registerInspectionTools(effectiveServer, bm);
      registerVisualTools(effectiveServer, bm);
      registerTabTools(effectiveServer, bm);
      registerSettingsTools(effectiveServer, bm);
      registerIframeTools(effectiveServer, bm);
      registerAutomationTools(effectiveServer, bm);
    }
Behavior4/5

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

Describes circular buffer behavior, clear parameter effect, return format (timestamped list) and empty case. No annotations exist, so description handles behavioral disclosure well. Minor omission: buffer size not mentioned.

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?

Concise, well-structured: purpose, usage, parameter, return, errors. Every sentence adds value; no redundancy.

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?

For a simple tool with 1 parameter and no output schema, description fully covers usage, return, and edge cases. References sibling for complementary behavior.

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 parameter 100% with description 'Clear the buffer after reading'. Tool description repeats this with 'Set to true to clear the buffer after reading'. Adds no significant new meaning; 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?

Clearly states it retrieves captured browser dialogs (alert, confirm, prompt) from a circular buffer. Unlike siblings like pilot_handle_dialog which configures handling, this tool retrieves past dialogs.

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?

Explicitly says to use when viewing dialogs, checking prompt text, or verifying dialog trigger. References sibling pilot_handle_dialog for auto-handling, providing clear when-to-use guidance.

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/TacosyHorchata/Pilot'

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