Skip to main content
Glama

accept_dialog

Accept browser dialogs during automation. Provide text input for prompt dialogs to continue automated workflows.

Instructions

Accept browser dialog. Provide promptText for prompts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptTextNoText for prompt dialogs

Implementation Reference

  • The main handler function for the 'accept_dialog' MCP tool. Parses input arguments, retrieves the Firefox instance via getFirefox(), calls firefox.acceptDialog(promptText), handles specific errors like no active dialog, and returns an MCP tool response.
    export async function handleAcceptDialog(args: unknown): Promise<McpToolResponse> {
      try {
        const { promptText } = (args as { promptText?: string }) || {};
    
        const { getFirefox } = await import('../index.js');
        const firefox = await getFirefox();
    
        try {
          await firefox.acceptDialog(promptText);
          return successResponse(promptText ? `✅ Accepted: "${promptText}"` : '✅ Accepted');
        } catch (error) {
          const errorMsg = (error as Error).message;
    
          // Concise error for no active dialog
          if (errorMsg.includes('no such alert') || errorMsg.includes('No dialog')) {
            throw new Error('No active dialog');
          }
    
          throw error;
        }
      } catch (error) {
        return errorResponse(error as Error);
      }
    }
  • Tool schema definition with name 'accept_dialog', description, and inputSchema for optional promptText string.
    export const acceptDialogTool = {
      name: 'accept_dialog',
      description: 'Accept browser dialog. Provide promptText for prompts.',
      inputSchema: {
        type: 'object',
        properties: {
          promptText: {
            type: 'string',
            description: 'Text for prompt dialogs',
          },
        },
      },
    };
  • src/index.ts:143-143 (registration)
    Registration of the 'accept_dialog' tool handler in the toolHandlers Map, which maps tool names to their execution functions for the MCP server.
    ['accept_dialog', tools.handleAcceptDialog],
  • src/index.ts:187-187 (registration)
    Inclusion of the acceptDialogTool schema in the allTools array, which is returned in response to MCP listTools requests.
    tools.acceptDialogTool,
  • Core implementation of dialog acceptance in PageManagement class using Selenium WebDriver: switches to alert, sends promptText if provided, and calls accept() on the alert.
    async acceptDialog(promptText?: string): Promise<void> {
      try {
        const alert = await this.driver.switchTo().alert();
        if (promptText !== undefined) {
          await alert.sendKeys(promptText);
        }
        await alert.accept();
      } catch (error) {
        throw new Error(
          `Failed to accept dialog: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Accept') but doesn't describe what happens after acceptance (e.g., does it proceed with default action, trigger a callback, or affect page state?), potential side effects, or error conditions. The mention of 'promptText' hints at input handling but lacks detail on behavioral outcomes.

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?

The description is extremely concise with two short sentences that are front-loaded and waste no words. Every sentence serves a purpose: the first states the core action, and the second provides a key parameter hint. It's appropriately sized for a simple tool with one parameter.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete for a browser interaction tool. It doesn't explain return values, error handling, or what 'accept' entails in different dialog contexts (e.g., alerts, confirms, prompts). For a tool that interacts with dynamic browser elements, more context on behavior and outcomes is needed.

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?

The description adds minimal value beyond the input schema, which has 100% coverage. It mentions 'promptText for prompts' but doesn't clarify when this is needed (e.g., for JavaScript prompts vs. other dialogs) or provide examples. With one parameter and high schema coverage, the baseline is 3, as the description doesn't significantly enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Accept browser dialog') and specifies the resource ('browser dialog'), making the purpose immediately understandable. It distinguishes from the sibling 'dismiss_dialog' by indicating acceptance rather than dismissal, though it doesn't explicitly contrast them. The description is specific but could be more precise about what type of dialog it handles.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'dismiss_dialog' or other browser interaction tools. It mentions 'promptText for prompts' but doesn't explain when this parameter is required or optional, leaving usage context unclear. No explicit when/when-not instructions or prerequisites are included.

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/mozilla/firefox-devtools-mcp'

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