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)}` ); } }

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

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