Skip to main content
Glama

browser_resize

Resize browser windows to specified dimensions using Playwright MCP, enabling precise control for web automation tasks and structured accessibility testing.

Instructions

Resize the browser window

Input Schema

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

Implementation Reference

  • Handler implementation for the 'browser_resize' tool. Adds resize code to response and sets the page viewport size using the provided width and height parameters.
    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 (width and height as numbers), and type.
    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', },
  • Module-level registration of the 'browser_resize' tool (as 'resize') in the default export array, which is later imported and spread into the global tools list.
    export default [ close, resize ];
  • src/tools.ts:36-52 (registration)
    Global registration of all tools, including those from common.ts (which contains 'browser_resize'), by spreading the imported tool arrays into allTools.
    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