resize_browser
Resize browser windows to specified dimensions using a Chrome Debug MCP Server. Enables precise window adjustment for automation tasks within persistent login sessions.
Instructions
调整浏览器窗口大小
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes | 窗口大小,格式为 'width,height' |
Implementation Reference
- src/browserSession.ts:538-549 (handler)Core implementation of resize_browser tool: parses 'width,height', sets viewport size and browser window bounds using Puppeteer CDP session.async resize(size: string): Promise<BrowserActionResult> { return this.doAction(async (page) => { const [width, height] = size.split(",").map(Number); const session = await page.createCDPSession(); await page.setViewport({ width, height }); const { windowId } = await session.send("Browser.getWindowForTarget"); await session.send("Browser.setWindowBounds", { bounds: { width, height }, windowId, }); }); }
- src/index.ts:218-223 (registration)Dispatches resize_browser tool calls to BrowserSession.resize method with input validation.case "resize_browser": if (!args?.size) { throw new Error("size参数是必需的"); } result = await this.browserSession.resize(args.size as string); break;
- src/index.ts:141-153 (schema)Defines the tool name, description, and input schema (size: string in 'width,height' format) for resize_browser in the tools list.name: "resize_browser", description: "调整浏览器窗口大小", inputSchema: { type: "object", properties: { size: { type: "string", description: "窗口大小,格式为 'width,height'", }, }, required: ["size"], }, },