Skip to main content
Glama
Rainmen-xia

Chrome Debug MCP Server

by Rainmen-xia

resize_browser

Adjust browser window dimensions for testing responsive web designs or capturing screenshots at specific resolutions.

Instructions

调整浏览器窗口大小

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sizeYes窗口大小,格式为 'width,height'

Implementation Reference

  • Core implementation of resize_browser tool: parses 'width,height' string, sets page viewport, and resizes the browser window using CDP Browser domain commands.
    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:140-153 (registration)
    Tool registration in listTools handler, including name, description, and input schema definition.
    {
    	name: "resize_browser",
    	description: "调整浏览器窗口大小",
    	inputSchema: {
    		type: "object",
    		properties: {
    			size: {
    				type: "string",
    				description: "窗口大小,格式为 'width,height'",
    			},
    		},
    		required: ["size"],
    	},
    },
  • Dispatch handler in CallToolRequestSchema that validates input and calls BrowserSession.resize().
    case "resize_browser":
    	if (!args?.size) {
    		throw new Error("size参数是必需的");
    	}
    	result = await this.browserSession.resize(args.size as string);
    	break;
  • Helper function providing success message for resize_browser tool.
    case "resize_browser":
    	return "✅ 浏览器窗口大小调整完成";

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/Rainmen-xia/chrome-debug-mcp'

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