Skip to main content
Glama

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
NameRequiredDescriptionDefault
heightYesHeight of the browser window
widthYesWidth of the browser window

Implementation Reference

  • 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 }); }); },
  • 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, ];

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

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