browser_resize
Adjust browser window dimensions using precise width and height inputs to optimize web page testing and interaction within the Playwright MCP environment.
Instructions
Resize the browser window
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| height | Yes | Height of the browser window | |
| width | Yes | Width of the browser window |
Implementation Reference
- src/tools/common.ts:51-57 (handler)The handler function for the 'browser_resize' tool. It adds the resize code to the response and sets the viewport size on the current tab's page.handle: async (tab, params, response) => { response.addCode(`await page.setViewportSize({ width: ${params.width}, height: ${params.height} });`); await tab.waitForCompletion(async () => { await tab.page.setViewportSize({ width: params.width, height: params.height }); }); },
- src/tools/common.ts:40-49 (schema)The schema definition for the 'browser_resize' tool, specifying name, title, description, and input schema for width and height.schema: { name: 'browser_resize', title: 'Resize browser window', description: 'Resize the browser window', inputSchema: z.object({ width: z.number().describe('Width of the browser window'), height: z.number().describe('Height of the browser window'), }), type: 'readOnly', },
- src/tools.ts:36-52 (registration)Registers the 'browser_resize' tool (from common.ts) by spreading the common tools array into the allTools export, which is later used by the backend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];