Skip to main content
Glama

browser_switch_to_original_window

Switch back to the original browser window when working with multiple browser windows during web automation tasks.

Instructions

Switches back to the original browser window

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler function for the 'browser_switch_to_original_window' tool. It retrieves the browser driver, gets all window handles, assumes the first one is the original, switches to it, and returns appropriate success or error messages.
    server.tool('browser_switch_to_original_window', 'Switches back to the original browser window', {}, async () => { try { const driver = stateManager.getDriver(); const windowHandles = await driver.getAllWindowHandles(); const originalHandle = windowHandles[0]; if (!originalHandle) { return { content: [ { type: 'text', text: `No original window handle found.`, }, ], }; } await driver.switchTo().window(originalHandle); return { content: [{ type: 'text', text: `Switched to original window` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error switching to original window: ${(e as Error).message}`, }, ], }; } });

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/pshivapr/selenium-mcp'

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