Use Case

Visual Verification for Coding Agents

A coding agent that changes UI should look at the result. GetScreenshot lets it capture the page it just changed without a local browser, and get back an image small enough to read.

The Challenge

An agent can edit a stylesheet, run the tests and report success without ever seeing the page. The tests pass and the button is still off-screen on a phone. Giving the agent a way to look is harder than it sounds.

  • Cloud agents, sandboxes and CI runners have no browser and often can't launch Chromium
  • A raw full-page screenshot from a local browser tool is large. At 1280x6000 it is about 9,890 image tokens, using the estimate ceil(w/28) * ceil(h/28)
  • If a tall image is shrunk to fit a model's size limit, small text stops being readable

The Solution

GetScreenshot renders the page on its own servers and the MCP server hands the agent images sized for a vision model. The agent makes one tool call and gets a picture, a link to the full-resolution original and an estimated token cost.

  • A hosted HTTPS call. It works from any environment that can reach the internet
  • A 1280x800 viewport is one image of about 1,334 tokens. Full pages arrive as slices of about 1,564 tokens each
  • A diff tool that reports how much changed and where

Three Tools, Three Checks

What the agent calls, and when

  1. 1

    capture_screenshot on a preview or staging URL

    After the branch deploys, the agent captures the page it changed. A phone preset checks the responsive layout in the same step.

    {
      "url": "https://my-branch.preview.example.com/pricing",
      "device": "iphone12"
    }

    To check one component, add "element": ".pricing-table". The image is smaller and the detail is sharper. If the selector matches nothing the capture fails, so the agent should use a selector it has seen in the markup.

  2. 2

    render_html for a component the agent just wrote

    Nothing needs to be deployed. The agent passes the HTML as a string, up to 2 MB, and gets a screenshot of it. This suits a standalone component, an email template or a generated report.

    {
      "html": "<!doctype html><html><head><style>.card { font-family: sans-serif; padding: 24px; border: 1px solid #ddd; border-radius: 8px; }</style></head><body><div class=\"card\"><h2>Pro plan</h2><p>$20 per month</p></div></body></html>",
      "width": 600,
      "height": 400
    }

    Relative asset URLs will not resolve. Inline the CSS, or set <base href> to a public origin that serves the assets.

  3. 3

    compare_screenshots for before and after

    The agent diffs production against the preview. The result gives the percentage of pixels that changed, the bounding box of the changed area and a diff image with the changes highlighted.

    {
      "before": { "url": "https://www.example.com/pricing" },
      "after": { "url": "https://my-branch.preview.example.com/pricing" },
      "full_page": true
    }

    A change that was meant to touch the header should show a bounding box around the header. A box that covers the whole page means something else moved. This call uses two screenshots, one per URL. Passing an earlier result as {"screenshot_url": "..."} reuses it without a new capture.

Put It in Your Agent's Rules File

An agent will not check its work unless it is told to. Paste this into AGENTS.md or CLAUDE.md and adjust the URLs.

## Visual verification

After any change to UI code (components, styles, templates, layout), look at
the result before reporting the task as done.

1. Wait for the preview deployment of the branch. Call `capture_screenshot` on
   each page you changed. Capture the default desktop viewport and one phone
   (`device: "iphone12"`).
2. For a standalone component or an email template, call `render_html` with the
   full HTML and inlined CSS instead.
3. For a change that should be local to one area, call `compare_screenshots`
   with production as `before` and the preview as `after`. Check that the
   changed area is where you expected it.
4. Look at the images. Fix anything that is cut off, overlapping, unstyled or
   unreadable, then capture again.
5. Do not capture localhost. The API cannot reach it. Use the preview URL.
6. Every capture uses quota, including failed ones. Prefer `element` or the
   viewport over `full_page`, and change something before you retry.
7. In your final message, say which pages you captured and include the
   screenshot URLs.

No MCP client? The CLI and agent skill run the same loop from a shell.

What a Look Catches

Problems that pass a type check and a unit test

Broken responsive layouts

A grid that works at 1280 px and overflows at 390 px. Capture with a device preset to see it.

Missing styles

A class name that does not exist, or a stylesheet that did not load. The page renders as unstyled HTML.

Overlap and clipping

Text that runs under an icon, a modal cut off by its container, a sticky header covering the first heading.

Unintended side effects

A shared CSS rule that changed three other pages. The diff's bounding box shows where pixels moved.

Error pages

The result includes the page's HTTP status. A 404 or 500 there tells the agent it captured an error page and the route is broken.

Generated HTML that looks wrong

A chart, table or email the agent produced. Rendering it once shows whether it is usable.

Limits to Plan Around

  • It cannot see localhost. The capture runs on GetScreenshot's servers and cannot reach your dev server or a private network. Use a preview deployment, a tunnel, or render_html.
  • The preview URL has to be public. A preview behind a login or an IP allowlist cannot be captured. The agent would get the login page or an error.
  • It takes one capture per call. It does not click through a flow or keep a session. If verification means logging in and navigating, a local browser tool such as Playwright MCP is the right choice. Compare the two.
  • Captures are stored at public URLs for 30 days. Anyone with the URL can open the image. Do not capture pages that show customer data or secrets.
  • A capture takes a few seconds. About 9 seconds is typical, and the API gives up at 90. It fits a check at the end of a task better than a check after every edit.

Let Your Agent See Its Work

Plans start at $5/month for 2,500 screenshots. The MCP server works on every plan.