Skip to main content
Glama

browser_resize

Adjust browser window dimensions to specific width and height values for testing or automation purposes.

Instructions

Resize the browser window

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYesNew width of the browser window
heightYesNew height of the browser window

Implementation Reference

  • Executes the browser window resize by calling setRect on the current WebDriver instance.
    async ({ width, height }) => {
      try {
        const driver = stateManager.getDriver();
        await driver.manage().window().setRect({ width, height });
        return {
          content: [
            {
              type: 'text',
              text: `Browser window resized to ${width}x${height}`,
            },
          ],
        };
      } catch (e) {
        return {
          content: [
            {
              type: 'text',
              text: `Error resizing browser window: ${(e as Error).message}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining numeric width and height parameters for resizing the browser window.
    {
      width: z.number().describe('New width of the browser window'),
      height: z.number().describe('New height of the browser window'),
    },
  • Registers the 'browser_resize' tool on the MCP server with description, input schema, and handler function.
    server.tool(
      'browser_resize',
      'Resize the browser window',
      {
        width: z.number().describe('New width of the browser window'),
        height: z.number().describe('New height of the browser window'),
      },
      async ({ width, height }) => {
        try {
          const driver = stateManager.getDriver();
          await driver.manage().window().setRect({ width, height });
          return {
            content: [
              {
                type: 'text',
                text: `Browser window resized to ${width}x${height}`,
              },
            ],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error resizing browser window: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • src/tools/index.ts:9-9 (registration)
    Invocation of registerBrowserTools function to register all browser tools, including 'browser_resize'.
    registerBrowserTools(server, stateManager);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. 'Resize' implies a mutation operation, but the description doesn't disclose whether this requires specific permissions, affects browser state persistently, has side effects on page layout, or what happens with invalid dimensions. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it immediately scannable and efficient for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after resizing (e.g., whether it returns success/failure, affects page rendering, or has constraints like minimum/maximum dimensions). Given the complexity of browser interactions and lack of structured safety hints, more behavioral context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('width' and 'height') clearly documented in the schema. The description doesn't add any parameter-specific context beyond what the schema provides (e.g., units, valid ranges, or interaction effects), so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Resize') and target resource ('the browser window'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'browser_maximize' which also affects window dimensions, missing an opportunity to clarify scope distinctions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'browser_maximize' or 'browser_scroll_by_pixels' for viewport adjustments. There's no mention of prerequisites (e.g., browser must be open) or typical use cases, leaving the agent to infer context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/pshivapr/selenium-mcp'

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