Skip to content

Sync browser_take_screenshot with upstream Playwright MCP: add webp output format (blocked on Playwright bump) #123

Closed

Description

@JustasMonkev

Summary

Automated upstream-monitoring run (2026-07-10) against microsoft/playwright, focused on Playwright MCP changes.

Baseline for this run was the last mirrored change, #121 → upstream microsoft/playwright#41676 (commit 39a418a, CDP noDefaults). One newer upstream MCP change is relevant to a tool this repo directly mirrors, but it cannot be mirrored yet because it depends on a Playwright core release we don't pin — hence an issue rather than a PR.

Upstream change

Upstream added 'webp' as an output format to both the core screenshot API (page.screenshot() / locator.screenshot()) and the MCP browser_take_screenshot tool. The tool's schema changed from z.enum(['png', 'jpeg']) to z.enum(['png', 'jpeg', 'webp']), with native WebP encoding wired through CDP (Chromium), Page.screenshot (Firefox), and a WASM libwebp re-encode path for WebKit on macOS.

Why it matters here

This repo mirrors that exact tool in src/tools/screenshot.ts:

  • Line 26: type: z.enum(['png', 'jpeg']).default('png') — no webp.
  • Line 28: filename default describes only {png|jpeg}.
  • Line 59: quality: fileType === 'png' ? undefined : 90 — would apply to webp as-is.
  • Line 84: contentType: fileType === 'png' ? 'image/png' : 'image/jpeg' — would need an image/webp branch.
  • Line 58: type: fileType is passed straight into playwright.PageScreenshotOptions.

So the tool surface has diverged: users of this MCP server can't request WebP screenshots even though upstream now supports it.

Why this is blocked (needs maintainer decision)

The webp screenshot support is a new Playwright core capability, not just an MCP wrapper change. This repo pins:

"playwright": "1.61.0",
"playwright-core": "1.61.0",

#41152 merged to main on 2026-07-10 and is not part of 1.61.0. On the pinned version, page.screenshot({ type: 'webp' }) would both fail TypeScript typecheck (the type union is 'png' | 'jpeg') and throw at runtime. Mirroring the enum without the underlying support would break browser_take_screenshot.

Mirroring therefore requires bumping playwright / playwright-core to the first release that includes #41152, which the past bump history shows is a deliberate, review-worthy step (e.g. #66f9c6d bumping to 1.61.0, plus the 1.59/1.60 breakage fixes).

Proposed action

When playwright is next bumped to a release containing #41152:

  1. Add 'webp' to the type enum in screenshotSchema and update the filename default description to {png|jpeg|webp}.
  2. Add an image/webp branch to the contentType logic at line 84.
  3. Confirm quality: 90 is appropriate for webp (matches upstream default handling).
  4. Add/extend coverage in the screenshot tests and update the browser_take_screenshot section of README.md.

Keep the change minimal and gated on the version bump — do not add webp to the schema before the pinned Playwright supports it.

Also reviewed this run — no action needed

Other MCP commits merged upstream since the baseline were checked and do not apply to this repo:

  • microsoft/playwright#41646 (a9ae10f, "await init page before screenshot") — adds tab.waitForInitialized() for the --init-script init-page feature, which this repo does not implement.
  • microsoft/playwright#41680 (142a273, "preserve directory for additional tab videos") — fixes per-tab video filename directory handling; this repo has no video-recording surface.
  • 1fbd702 ("don't crash the response when navigating closes the last tab") — this repo's src/response.ts already guards the empty-tabs case (finish() only snapshots when currentTab exists; renderTabsMarkdown renders a graceful "No open tabs" message), so it isn't affected.
  • microsoft/playwright#41719 ("skip ARIA snapshot serialization when snapshot-mode=none") — still open upstream, and this repo has no snapshot-mode config; re-evaluate if/when it merges.

Activity

  1. JustasMonkev commented on Jul 19, 2026

    @JustasMonkev
    OwnerAuthor

    Upstream-monitoring update (2026-07-19): still blocked — the recent Playwright bump does not unblock this.

    package.json now pins playwright / playwright-core 1.61.1 (bumped from 1.61.0 in #129 as part of the TypeScript 7 upgrade, not a deliberate feature bump). I verified against the published [email protected] tarball that the screenshot type union is still:

    type?: "png"|"jpeg";

    i.e. microsoft/playwright#41152 (webp screenshot format) is a main-branch feature that was not cherry-picked into the 1.61.x patch line. Adding 'webp' to screenshotSchema on 1.61.1 would still fail typecheck (union is 'png' | 'jpeg') and throw at runtime.

    The blocking condition in this issue is unchanged: mirror only once playwright is bumped to a release that actually contains #41152 (expected 1.62+). Leaving this open and blocked.


    Generated by Claude Code

  2. added a commit that references this issue on Jul 27, 2026
    8703615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions