dismiss_dialog
Close browser dialog windows during automated Firefox testing or web scraping to continue script execution.
Instructions
Dismiss browser dialog.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/utilities.ts:95-116 (handler)MCP tool handler function that acquires Firefox instance and calls dismissDialog(), with specific error handling for no active dialog.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); } }
- src/tools/utilities.ts:23-30 (schema)Tool schema definition with name 'dismiss_dialog', 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-146 (registration)Registration of the dismiss_dialog handler in the central toolHandlers Map used by the MCP Server for tool execution.// Utilities ['accept_dialog', tools.handleAcceptDialog], ['dismiss_dialog', tools.handleDismissDialog], ['navigate_history', tools.handleNavigateHistory], ['set_viewport_size', tools.handleSetViewportSize],
- src/index.ts:186-190 (registration)Inclusion of dismissDialogTool in the allTools array, which is returned in response to listTools requests.// Utilities tools.acceptDialogTool, tools.dismissDialogTool, tools.navigateHistoryTool, tools.setViewportSizeTool,
- src/firefox/pages.ts:65-74 (helper)Core Firefox PageManagement helper method that uses WebDriver to switch to the alert dialog and dismiss it.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)}` ); } }