Skip to main content
Glama

browser_resize

Adjust browser window dimensions to test responsive web designs or simulate different screen sizes for automated testing.

Instructions

Resize the browser window

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYesWidth of the browser window
heightYesHeight of the browser window

Implementation Reference

  • The handler function for the 'browser_resize' tool. It adds explanatory code comments to the response and resizes the browser viewport to the specified width and height using the page.setViewportSize method within a waitForCompletion block.
    handle: async (tab, params, response) => { response.addCode(`// Resize browser window to ${params.width}x${params.height}`); 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 }); }); },
  • Schema definition for the 'browser_resize' tool, including name, title, description, input schema validating width and height as numbers, and type as readOnly.
    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)
    Central registration of all tools, including 'browser_resize' via spreading the exports from common.ts (which defines browser_resize) into the allTools array.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];

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/nzjami/mcpPlaywright'

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