Dea DardanicaDocumentation
Devices and viewportsRead Markdown

set_viewport

Pin the page to a viewport size instead of letting it follow the window — use this to test a layout at a known width rather than resizing the window by hand. preset: mobile (390x844), tablet (820x1180), laptop (1280x800), desktop (1440x900), wide (1920x1080), or responsive to unpin and track the window again. Or pass width (and optionally height) for a custom size. A viewport larger than the window renders scaled down to fit, but the page still lays out at the full pinned width, so CSS breakpoints and screenshots are true to that size. A pinned width below 768px is served the phone identity (mobile user agent and client hints), at or above it the desktop one; pinning across that line reloads the page once. Responsive (following the window) is always desktop. This applies to the active tab only — each tab keeps its own viewport, so different tabs can be different sizes. Returns the applied viewport, the identity, and the display scale.

Example#

Call this MCP tool with the argument object below. Replace illustrative IDs, selectors, local paths, and project URLs with values observed in your session.

json
{
  "preset": "desktop"
}

Usage notes#

Use a preset or custom width; responsive unpins. A display scale below 1 does not change the requested CSS layout width. Crossing the pinned 768px identity boundary reloads once.

Result#

Returns the applied viewport, pinning state, browser identity, and display scale.

Results arrive in MCP content blocks. Most structured results are JSON in text blocks; image tools can include image blocks. Handle errors and partial or truncated data. No formal output schema is declared for this tool.

Parameters#

set_viewport — table 1
ParameterTypeRequiredDescription
preset"mobile" / "tablet" / "laptop" / "desktop" / "wide" / "responsive"NoNamed size, or 'responsive' to unpin and follow the window
widthnumberNoCustom CSS width in px (240-3840)
heightnumberNoCustom CSS height in px (320-2400), defaults to the stage height
tabstringNoTab name or id in your workspace; does not change the visible tab. minLength: 1

Full input schema#

The schema includes nested shapes and constraints. Additional semantic constraints can apply at runtime; read the description and usage notes.

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "preset": {
      "description": "Named size, or 'responsive' to unpin and follow the window",
      "type": "string",
      "enum": [
        "mobile",
        "tablet",
        "laptop",
        "desktop",
        "wide",
        "responsive"
      ]
    },
    "width": {
      "description": "Custom CSS width in px (240-3840)",
      "type": "number"
    },
    "height": {
      "description": "Custom CSS height in px (320-2400), defaults to the stage height",
      "type": "number"
    },
    "tab": {
      "description": "Tab name or id in your workspace; does not change the visible tab.",
      "type": "string",
      "minLength": 1
    }
  },
  "additionalProperties": false
}

Reference conventions · Agent operating guide · Troubleshooting