Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

resize

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

Instructions

Resize the browser viewport

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYes
heightYes

Implementation Reference

  • The core handler function in PlaywrightController that resizes the browser viewport by setting the page viewport size.
    async resize(width: number, height: number): Promise<void> {
      try {
        if (!this.isInitialized() || !this.state.page) {
          throw new Error('Browser not initialized');
        }
        this.log('Resizing viewport', { width, height });
        await this.state.page.setViewportSize({ width, height });
        this.log('Resize complete');
      } catch (error: any) {
        console.error('Resize error:', error);
        throw new BrowserError('Failed to resize viewport', 'Check if width and height are positive numbers');
      }
    }
  • Tool schema definition including name, description, and input schema requiring width and height as numbers.
    const RESIZE_TOOL: Tool = {
      name: "resize",
      description: "Resize the browser viewport",
      inputSchema: {
        type: "object",
        properties: {
          width: { type: "number" },
          height: { type: "number" }
        },
        required: ["width", "height"]
      }
    };
  • src/server.ts:542-542 (registration)
    Registration of the resize tool in the tools object passed to MCP server capabilities.
    resize: RESIZE_TOOL,
  • Tool dispatch logic in the callTool handler: validates arguments, calls the controller resize method, and returns success response.
    case 'resize': {
      if (typeof args.width !== 'number' || typeof args.height !== 'number') {
        return {
          content: [{ type: "text", text: "Width and height are required" }],
          isError: true
        };
      }
      await playwrightController.resize(args.width, args.height);
      return {
        content: [{ type: "text", text: "Browser resized successfully" }]
      };
    }
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 only states the basic action. It doesn't disclose behavioral traits such as whether this requires an active browser session, what happens if dimensions are invalid, if it affects page rendering, or any side effects. The description is minimal and lacks necessary operational context.

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, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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?

Given the complexity (a mutation tool with no annotations, no output schema, and 2 parameters), the description is incomplete. It doesn't explain what the tool returns, error conditions, or practical usage context, leaving significant gaps for an AI agent to understand how to invoke it correctly.

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?

The description doesn't mention parameters at all, and schema description coverage is 0%. However, with only 2 parameters (width and height) that are self-explanatory for a resize operation, the baseline is 3 as the schema provides the structure, though the description adds no value beyond it.

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 ('browser viewport'), providing a specific verb+resource combination. However, it doesn't differentiate from siblings like 'screenshot' or 'takeScreenshot' which also involve viewport manipulation, so it doesn't reach the highest score.

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. There's no mention of prerequisites (e.g., needing an open browser), exclusions, or comparison to sibling tools like 'screenshot' that might serve similar testing purposes.

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/jomon003/PlayMCP'

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