Skip to main content
Glama
Playwright MCP Server

Playwright MCP Server

by sohitmahato

playwright_set_viewport

Set the browser viewport width and height to test responsive layouts or capture pages at specific screen sizes.

Instructions

Set viewport size

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "width": "<width>",
      "height": "<height>"
    },
    "name": "playwright_set_viewport"
  }
}

Input Schema

NameRequiredDescriptionDefault
widthYesViewport width
heightYesViewport height

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.1/5.0
Behavior1/5

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

No annotations are supplied, so the description carries the full behavioral burden, yet it discloses nothing: no units (pixels assumed but unstated), no effect on the current page or existing screenshots, no requirement that a page be open, and no indication of failure modes for invalid sizes.

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

Conciseness3/5

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

It is a single short fragment with zero waste, but that brevity comes from under-specification rather than disciplined editing; there is no front-loaded context to speak of because there is almost no content.

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 two-parameter, no-output tool the bar is low, but with no annotations and no output schema the description should at minimum state units and when the change takes effect. It leaves both unaddressed, so an agent cannot call it confidently without guessing.

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 coverage is 100%, so width and height are already documented in the schema as "Viewport width" and "Viewport height". The description adds nothing beyond that — notably no unit or valid-range information — so the baseline 3 applies.

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

Purpose2/5

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

"Set viewport size" is essentially a restatement of the tool name playwright_set_viewport; it names the verb and resource but adds no distinguishing scope, such as whether it applies to the current page only or persists across navigations.

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?

There is no when-to-use guidance at all: nothing about calling it before screenshots, before navigation, or in relation to siblings like playwright_screenshot or playwright_navigate. The agent must infer the workflow position entirely on its own.

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