Skip to content

Add named Playwright executor support - #235

Merged
rgarcia merged 6 commits into
mainfrom
hypeship/playwright-executors
Oct 8, 2026
Merged

rgarcia merged 6 commits into
mainfrom
hypeship/playwright-executors

Conversation

@rgarcia

@rgarcia rgarcia commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds named Playwright executor support to the MCP server, matching the browser API's executor surface.

  • execute_playwright_code gains an optional executor parameter (^[A-Za-z0-9_-]{1,64}$), passed to the SDK only when set. Omitting it (or passing default) keeps today's behavior: page is bound to the active tab. Any other name runs the call in a named executor that owns its own background tab, so independent tasks can run in parallel in separate tabs of one browser while calls on the same executor stay serialized.
  • The execute result now includes tab (target_id, created) when the API reports the tab page was bound to.
  • A 409 from execute (the browser already has 8 named executors) is surfaced with the API body, so the agent sees the message and the current executors and can reuse or delete one.
  • New manage_playwright_executors tool in the playwright toolset with list and delete actions. delete takes name and an optional close_tab (default true); deleting default restarts it instead of removing it.
  • Tool descriptions explain when to use executors; README tool list updated; tool-names.ts and the registration tests include the new tool.

Dependencies

Depends on @onkernel/sdk 0.120.0 (released), which includes browsers.playwright.executors and the executor / tab fields on execute. package.json is bumped to "@onkernel/sdk": "0.120.0" and the lockfile change is limited to that dependency.

Tests

  • New src/lib/mcp/tools/playwright.test.ts covers executor passthrough, name validation, tab in the result, the 409 limit error, and list/delete (default close_tab, explicit close_tab: false, default restart wording, missing name, API 404).
  • bunx tsc --noEmit --incremental false, bun test (902 pass), and bun run check:managed-auth-app pass locally. bun run format:check reports only a pre-existing issue in AGENTS.md, which this PR does not touch.

Add an optional executor parameter to execute_playwright_code, surface the
tab page was bound to in its result, and report the current executors when
the browser is at its named executor limit. Add manage_playwright_executors
with list and delete actions. Point @onkernel/sdk at a vendored preview build
that includes the executors surface.
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mcp Ready Ready Preview Oct 8, 2026 8:04pm UTC

Replace the vendored preview tarball with the published package that
includes the Playwright executors surface.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8503898. Configure here.

Comment thread src/lib/mcp/tools/playwright.ts Outdated
@socket-security

socket-security Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​onkernel/​sdk@​0.117.0 ⏵ 0.120.081 +1100100 +199 +1100

View full report

@masnwilliams masnwilliams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving. the executor plumbing is clean: manage_playwright_executors follows the manage_replays shape, the shared name schema is a nice touch, and gating the 409 on a named call in the latest commit is the right scope. notes below are non-blocking; the first is the one i'd most like before merge.

worth doing before merge:

  • the execute_playwright_code description lost two lines when it was aligned with the API spec: "for reusable site actions, check webmcp.listTools() first and prefer a suitable structured tool; use playwright when none is exposed" (added in #213 on purpose) and "does not create or delete browsers -- use manage_browsers for session lifecycle" (the README still says this). can we add both back? same thing bugbot flagged on 8503898. separately, the description went from ~300 to ~2.7k chars and some of it (post-timeout process behavior, multi-window active tab, old images) isn't something an agent acts on. trimming is optional, restoring the two lines is the ask.

optional cleanups:

  • the fallback note passed to throwToolErrorWithApiBody on the 409 never shows: the helper only appends it when the body isn't an object, and the limit error always is. either drop the arg or change the helper if you want the pointer to manage_playwright_executors in the error text.
  • JSON.stringify already drops undefined fields, so ...(response.tab && { tab: response.tab }) can be tab: response.tab, and the whole hand-built block is equivalent to return jsonResponse(response).

follow-ups (fine to skip here):

  • KERNEL_MCP_ENABLED_TOOLSETS=manage_playwright_executors throws unknown (the manage_ strip leaves playwright_executors). one-line fix is adding it to standaloneToolsetAliases in register.ts.
  • the session-name description in browsers.ts lists the tools that accept a session name as session_id; this one isn't in it.
  • toolResultText is now duplicated in playwright.test.ts and browsers.test.ts, could live in mcp-test-fixtures.ts next to toolResultJSON.

Restore the WebMCP-first and manage_browsers lines in the execute
description, return the execute response as-is, drop the fallback note
the API-body error helper never shows, accept manage_playwright_executors
as a toolset alias, list it among the tools that take a session name, and
share the toolResultText test helper.
@rgarcia

rgarcia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

thanks for the review. addressed in 53d5d50:

  • restored both lines in the execute_playwright_code description (webmcp-first, and manage_browsers for lifecycle). left the spec-derived body as is for now.
  • dropped the fallback note on the 409 path since the helper never showed it; the description already points at manage_playwright_executors.
  • execute now returns jsonResponse(response).
  • follow-ups taken here too since they were one-liners: manage_playwright_executors resolves as a toolset alias (covered in the enabled-toolsets test), it is listed among the tools that accept a session name, and toolResultText moved to mcp-test-fixtures.ts.

@rgarcia
rgarcia merged commit dd5c4a9 into main Oct 8, 2026
10 checks passed
@rgarcia
rgarcia deleted the hypeship/playwright-executors branch October 8, 2026 20:21

This branch was successfully deployed

1 active deployment
Preview — 53d5d509 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants