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
| Name | Required | Description | Default |
|---|---|---|---|
| width | Yes | New width of the browser window | |
| height | Yes | New height of the browser window |
Implementation Reference
- src/tools/browserTools.ts:190-212 (handler)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}`, }, ], }; } }
- src/tools/browserTools.ts:186-189 (schema)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'), },
- src/tools/browserTools.ts:183-213 (registration)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);