Skip to main content
Glama

browser_resize

Adjust browser window dimensions to specific width and height values for testing or automation purposes.

Instructions

Resize the browser window

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYesNew width of the browser window
heightYesNew height of the browser window

Implementation Reference

  • Executes the browser window resize by calling setRect on the current WebDriver instance.
    async ({ width, height }) => { try { const driver = stateManager.getDriver(); await driver.manage().window().setRect({ width, height }); return { content: [ { type: 'text', text: `Browser window resized to ${width}x${height}`, }, ], }; } catch (e) { return { content: [ { type: 'text', text: `Error resizing browser window: ${(e as Error).message}`, }, ], }; } }
  • Zod input schema defining numeric width and height parameters for resizing the browser window.
    { width: z.number().describe('New width of the browser window'), height: z.number().describe('New height of the browser window'), },
  • Registers the 'browser_resize' tool on the MCP server with description, input schema, and handler function.
    server.tool( 'browser_resize', 'Resize the browser window', { width: z.number().describe('New width of the browser window'), height: z.number().describe('New height of the browser window'), }, async ({ width, height }) => { try { const driver = stateManager.getDriver(); await driver.manage().window().setRect({ width, height }); return { content: [ { type: 'text', text: `Browser window resized to ${width}x${height}`, }, ], }; } catch (e) { return { content: [ { type: 'text', text: `Error resizing browser window: ${(e as Error).message}`, }, ], }; } } );
  • src/tools/index.ts:9-9 (registration)
    Invocation of registerBrowserTools function to register all browser tools, including 'browser_resize'.
    registerBrowserTools(server, stateManager);

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