Two screenshots of one page, two sizes
Two captures of https://example.com produced two different files: 57,493 bytes at 1280×800 from the Playwright CLI, and 33,669 bytes at 780×493 through an MCP screenshot tool. The CLI command exited 0. The MCP call returned a pointer to a file rather than a status code, so the file itself is what has to be checked.
That difference is not a rendering bug and not a stale cache. It comes from two code paths that disagree about an argument neither names out loud: the viewport. One path is told the size; the other is told nothing, uses a default, and its screenshot tool also requires a parameter unrelated to the URL people assume it takes.
This post covers what each path produced on Linux x86_64 on 2026-11-23, what the schema requires, and how to check your own output instead of trusting it.
What was installed
The browser came from Playwright's own installer:
npx -y playwright@latest install chromium It downloaded Chrome Headless Shell 159.0.8154.6 (playwright chromium-headless-shell v1255) — 125.7 MiB of download that unpacks into roughly 700 MB under ~/.cache/ms-playwright. The download size and the cache footprint are different numbers; the cache is what ends up on disk after extraction.
Two clients then used that same binary: the Playwright CLI, and @playwright/mcp started through the MCP Inspector CLI, which sends one call per process and exits.
Path A: the CLI is told the size
npx -y playwright@latest screenshot --viewport-size=1280,800 https://example.com cli-shot.png The file lands where you asked. file reports:
cli-shot.png: PNG image data, 1280 x 800, 8-bit/color RGB, non-interlaced ls -l reports 57,493 bytes. A rerun on the same machine, later the same day, produced the same byte count and the same reported dimensions. That repeatability is the useful part: fixed viewport, same page, comparable output between runs.
Path B: a session that was already open
The 33,669-byte file did not come from one command. It came from a client that held a session across two calls: browser_navigate to https://example.com, then browser_take_screenshot in that same session. The trace shows the order — the navigation response carried Page Title: Example Domain, and the following call wrote out/mcp-shot.png and returned [Screenshot of viewport](out/mcp-shot.png).
That order matters: the Inspector CLI cannot do it, because it sends one call per process. A fresh process that calls browser_take_screenshot directly has no page in its session, so the file it writes captures about:blank. There is no single command that reproduces the 780×493 image; the smallest thing that does is a client that keeps one session open across both calls.
The client that does both calls
import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; import { ListRootsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; const ROOT = "file:///root/cd13c/ws"; // point this at your own empty directory const transport = new StdioClientTransport({ command: "npx", args: ["-y", "@playwright/mcp@latest", "--browser", "chromium"], stderr: "pipe", }); transport.stderr?.on("data", (b) => process.stderr.write("[server] " + b.toString())); const client = new Client( { name: "cd13c-two-call", version: "0.0.1" }, { capabilities: { roots: {} } } ); // the server asks for roots during initialization; answering it is the point client.setRequestHandler(ListRootsRequestSchema, async () => ({ roots: [{ uri: ROOT, name: "ws" }], })); const t0 = Date.now(); await client.connect(transport); console.log("CONNECT_OK ms=", Date.now() - t0); console.log("SERVER:", JSON.stringify(client.getServerVersion())); const t1 = Date.now(); const nav = await client.callTool({ name: "browser_navigate", arguments: { url: "https://example.com" } }); console.log("NAV_MS=", Date.now() - t1); console.log("NAV:", JSON.stringify(nav)); const t2 = Date.now(); const shot = await client.callTool({ name: "browser_take_screenshot", arguments: { scale: "css" } }); console.log("SHOT_MS=", Date.now() - t2); console.log("SHOT:", JSON.stringify(shot)); await client.close(); console.log("DONE"); Save it as two-call.mjs, install @modelcontextprotocol/sdk beside it, run node two-call.mjs. Two preconditions:
- The
roots/listhandler has to be there. Answer with one root; an empty directory is enough. Skip it and a call needing the workspace root never returns (300 seconds of silence in an earlier run), or the write is refused as outside the allowed roots. - Chromium is already in the cache from the install at the top of this post. This step does not download it again.
The timers printed CONNECT_OK ms= 2447, NAV_MS= 2926, SHOT_MS= 42, then DONE; exit 0. The file it wrote was 33,669 bytes, PNG image data, 780 x 493, MD5 fce0bd672a7c38d2192d84fbee7ed584.
That MD5 matches the file from the 2026-11-23 run on the same Linux machine: both runs produced one identical file, byte for byte, three days apart. In the 2026-11-26 run only scale: "css" was passed, no filename, so the tool picked the name and wrote it under .playwright-mcp/ inside the session's working root.
That size comes from the session's default viewport, 780×493, with scale: css — nothing the caller passed. So the CLI path answers "capture at the size I chose", and the MCP path answers "capture at the size this session happens to have".
The required parameter nobody mentions
browser_take_screenshot requires scale, whose values are css or device. Leave it out and the call is rejected by the tool schema before anything runs; the string url is not a parameter of this tool at all. That is the detail worth flagging: the neighbouring navigation tool takes a URL, so it is reasonable to assume this one does too. It does not.
That also explains a confusing class of failures: a call that looks right returns a schema error about a missing field, and the field has nothing to do with the page.
To make the MCP path produce 1280×800, the session would need viewport parameters passed at server start or per call; the exact name and behaviour were not tested here. Treat that as an open question, not as a recipe. What was measured is only this: with scale: css and no viewport argument, the output is 780×493.
Where the file is allowed to go
A screenshot tool writes a file, so it needs a place to write. In the MCP path that place is not the current working directory; it is constrained by the roots the session declares. Writing outside them fails with a message that names the boundary:
Error: File access denied: /root/cd10i/neg_pw.png is outside allowed roots. Allowed roots: /root/cd10h/se/.playwright-mcp, /root/cd10h/se The allow-list in that message is the answer, not noise. Those roots came from the roots/list response the client sent during initialization, not from pwd. Pointing the session at a working root — in this run, /root/cd10h/se — made the write succeed without changing the command. If you see this error, the fix is the session's declared roots, not a retry and not a different filename.
There is a second-order effect worth knowing: a client that does not answer roots/list at all can hang before a tool that asks for the workspace root returns. The server sends the request and waits. No stderr, no progress line, just a call that never comes back — measured here as 300 seconds of silence, then 60 seconds to a result once the client started answering.
What to check instead of trusting the picture
A screenshot is evidence only when you record what it is. Three checks are enough:
-
file <name>.png— the dimensions and colour type are printed by the tool, not inferred from the page. - Byte count — on a fixed page at a fixed viewport it should repeat; a change is a signal worth investigating.
- The path — confirm the file you are looking at is the file the call wrote, especially when a session default and an explicit argument are both in play.
What these checks do not prove: that two screenshots show the same rendering. A 780×493 capture and a 1280×800 one differ in layout because the viewport differs, so pixel comparison answers nothing about the page. Compare files produced under the same viewport if the question is "did the page change"; compare byte counts and dimensions when the question is "did the tool do what I asked".
Why this matters for MCP work
The interesting failures in MCP tooling are not crashes. They are two successful calls producing different artifacts, neither printing anything that explains the difference. The viewport, the required scale, the allowed roots — none are errors. They are defaults and contracts, visible only when output is measured rather than eyeballed.
The walkthrough behind these numbers follows one pattern: install, run one call, record bytes and dimensions, and note what was not tested. The automation page covers both paths side by side, including the commands above: https://anclum.com/en/scene/automation/
Everything here was measured on Linux x86_64. macOS and Windows were not run, so nothing here is a claim about them. The MCP viewport override, concurrency, long-lived sessions and reconnects were not tested. Treat the numbers as a baseline to reproduce, not as properties of the tool.
— David, maintainer of Anclum