Fix broken _snapshotForAI() tip in execute_playwright_code#126
Closed
masnwilliams wants to merge 1 commit into
Closed
Fix broken _snapshotForAI() tip in execute_playwright_code#126masnwilliams wants to merge 1 commit into
masnwilliams wants to merge 1 commit into
Conversation
The page._snapshotForAI() internal method is not available in the browser runtime, so the tool hint pointed users at a call that throws "page._snapshotForAI is not a function". Point it at the supported locator.ariaSnapshot() instead, which returns the page accessibility tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
masnwilliams
marked this pull request as ready for review
July 21, 2026 17:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
execute_playwright_codetool description tells users:That method does not exist in the browser runtime — calling it throws
TypeError: page._snapshotForAI is not a function. The runtime drives the browser through a stealth-patched Playwright engine, which strips the internal_snapshotForAI()binding (andpage.accessibility.snapshot()).This updates the hint to the supported public API,
page.locator("body").ariaSnapshot(), which returns the page accessibility tree and works in the current runtime.Verification
Ran against a live browser session:
page._snapshotForAI()→TypeError: page._snapshotForAI is not a functionpage.accessibility.snapshot()→TypeError(namespace absent)page.locator("body").ariaSnapshot()→ returns the aria/accessibility tree ✅Description-only change; no runtime behavior affected.
Follow-ups (not in this PR)
kernel/docs → reference/mcp-server/tools/execute-playwright-code.mdx_snapshotForAI()in their own code (e.g.kernel-ai-sdk-agent,ImmortalBard)Note
Low Risk
Documentation string change on an MCP tool schema only; no execution or security impact.
Overview
Updates the
execute_playwright_codeMCP tool’scodeparameter description so the snapshot tip points atpage.locator("body").ariaSnapshot()instead ofpage._snapshotForAI(), which is not available in Kernel’s browser runtime.This is a description-only change; tool execution and Playwright behavior are unchanged.
Reviewed by Cursor Bugbot for commit c42b421. Bugbot is set up for automated code reviews on this repo. Configure here.