Skip to main content
Glama

dismiss_dialog

Close active browser dialogs like alerts, confirms, or prompts during automated testing and browser control operations.

Instructions

Dismiss the active browser dialog (alert/confirm/prompt). Returns an error if no dialog is open.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'dismiss_dialog' MCP tool. It lazily initializes the Firefox instance, calls firefox.dismissDialog(), handles specific 'no dialog' errors, and returns success/error responses.
    export async function handleDismissDialog(_args: unknown): Promise<McpToolResponse> { try { const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); try { await firefox.dismissDialog(); return successResponse('✅ Dismissed'); } 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); } }
  • The tool schema definition for 'dismiss_dialog', including name, description, and empty input schema (no parameters required).
    export const dismissDialogTool = { name: 'dismiss_dialog', description: 'Dismiss browser dialog.', inputSchema: { type: 'object', properties: {}, }, };
  • src/index.ts:142-147 (registration)
    Registration of the dismiss_dialog handler in the central toolHandlers Map used by the MCP server to dispatch tool calls.
    // Utilities ['accept_dialog', tools.handleAcceptDialog], ['dismiss_dialog', tools.handleDismissDialog], ['navigate_history', tools.handleNavigateHistory], ['set_viewport_size', tools.handleSetViewportSize], ]);
  • src/index.ts:187-191 (registration)
    Inclusion of the dismissDialogTool schema in the allTools array returned by listTools.
    tools.acceptDialogTool, tools.dismissDialogTool, tools.navigateHistoryTool, tools.setViewportSizeTool, ];
  • Core helper method in PageManagement class that performs the actual WebDriver alert dismissal.
    async dismissDialog(): Promise<void> { try { const alert = await this.driver.switchTo().alert(); await alert.dismiss(); } catch (error) { throw new Error( `Failed to dismiss 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