Skip to main content
Glama

browser_resize

Adjust browser window dimensions for testing responsive web designs or capturing specific viewport states during automation.

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 resizes the viewport size of the current browser tab using the provided width and height parameters, generates a code snippet representing the action, defines an action to execute the resize, and returns the necessary metadata for execution.
    handle: async (context, params) => { const tab = context.currentTabOrDie(); const code = [ `// Resize browser window to ${params.width}x${params.height}`, `await page.setViewportSize({ width: ${params.width}, height: ${params.height} });` ]; const action = async () => { await tab.page.setViewportSize({ width: params.width, height: params.height }); }; return { code, action, captureSnapshot, waitForNetwork: true }; },
  • The 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:35-50 (registration)
    Registration of the browser_resize tool as part of the snapshotTools array, imported via common(true) which includes the resize tool.
    export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ];
  • src/tools.ts:52-66 (registration)
    Registration of the browser_resize tool as part of the visionTools array, imported via common(false) which includes the resize tool.
    export const visionTools: Tool<any>[] = [ ...common(false), ...console, ...dialogs(false), ...files(false), ...install, ...keyboard(false), ...navigate(false), ...network, ...pdf, ...tabs(false), ...testing, ...vision, ...wait(false), ];

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/Angeluis001/playwright-mcp'

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