Skip to content

Split screenshot into its own read-only tool - #135

Closed
masnwilliams wants to merge 2 commits into
mainfrom
hypeship/separate-screenshot-tool
Closed

Split screenshot into its own read-only tool#135
masnwilliams wants to merge 2 commits into
mainfrom
hypeship/separate-screenshot-tool

Conversation

@masnwilliams

@masnwilliams masnwilliams commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

screenshot was a terminal action inside computer_action. That bundled the one browser capability every multimodal model can use with the one that only works on models with pixel grounding, and it put a read-only capture behind a tool marked destructiveHint: true — so clients with per-tool approval prompt on taking a screenshot.

This splits screenshot out as a standalone tool and repositions the remaining tools:

  • screenshot — new, read-only (readOnlyHint: true, idempotentHint: true), optional region crop. Registered as its own toolset so it can be enabled/disabled independently of computer.
  • execute_playwright_code — description now states it's the primary way to drive a browser, and points at ariaSnapshot() for locating elements without an image.
  • computer_action — no longer handles screenshots. Description reframes it as the fallback for surfaces a selector can't reach (canvas, embedded PDFs, native dialogs, drag), and notes that coordinate accuracy depends on the calling model's grounding.
  • next_actions hints from manage_browsers and manage_browser_pools now suggest execute_playwright_code + screenshot instead of computer_action.

Bug fixed along the way

Region screenshots returned a cropped image but reported Viewport: WxH. Use these dimensions as the coordinate space. The image origin is the crop origin, not the screen origin, so a caller converting image coordinates to screen coordinates for a subsequent click had no way to know it needed to add region.x/y. The new tool reports the crop offset and the conversion explicitly.

Also drops a redundant browsers.retrieve call — viewport dimensions are only needed for the uncropped case.

Breaking change

computer_action no longer accepts screenshot as an action type. Callers batching click, ..., screenshot in one request now need two calls. That trade is deliberate: the batching win applies to the flow we're steering away from, and keeping a duplicate screenshot path in both tools would leave the destructive-hint problem half-fixed. Clients re-read the tool list on connect, so this lands on reconnect.

Not included

No screenshot downscaling. Pixel-grounding accuracy degrades above roughly 1024px wide, and the usual fix is to downscale server-side and rescale returned coordinates back up. That changes coordinate semantics for computer_action and is worth doing separately if we keep investing in the coordinate path.

Testing

tsc --noEmit clean, prettier --check clean on changed files, next build compiles (full build needs Clerk/CLI env vars this checkout doesn't have). Verified tool registration by instantiating the server and listing tools: screenshot registers, computer_action no longer advertises a screenshot action, and KERNEL_MCP_DISABLED_TOOLSETS=screenshot,computer removes both. The repo has no test suite, so there are no automated tests to add or run.


Note

Medium Risk
Breaking MCP contract: computer_action no longer supports screenshot, so existing clients must migrate; behavior change is limited to tool surface and agent guidance, not auth or data paths.

Overview
Screenshot moves out of computer_action into a dedicated screenshot MCP tool (readOnlyHint: true, optional region crop, its own screenshot toolset). computer_action no longer accepts a screenshot action type—callers that batched clicks plus screenshot need separate tool calls.

Tool guidance is updated so execute_playwright_code is described as the primary browser driver (including ariaSnapshot() for element discovery), computer_action is framed as a coordinate fallback for non-selector surfaces, and manage_browsers / manage_browser_pools next_actions point to Playwright + screenshot instead of computer_action. README and the debug prompt reference the new tool.

Region screenshots now explain crop offset vs screen coordinates (fixing misleading full-viewport wording on cropped images); full-screen captures still report viewport size. Screenshot handling is removed from computer-action.ts and implemented in src/lib/mcp/tools/screenshot.ts, registered in register.ts.

Reviewed by Cursor Bugbot for commit 3d56458. Bugbot is set up for automated code reviews on this repo. Configure here.

Screenshot was a terminal action inside computer_action, which meant the one
capability every multimodal model can use was gated behind a tool flagged
destructive, and clients with approval prompts confirmed on a read-only capture.

Extract it as a standalone screenshot tool and point tool descriptions at
execute_playwright_code as the default way to drive a browser, leaving
computer_action for surfaces no selector can reach.

Region screenshots also reported the full viewport as the coordinate space while
returning a cropped image, so the offset a caller needed to add was never stated.
The new tool reports the crop offset instead.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
mcp Ready Ready Preview Aug 3, 2026 4:04pm

@masnwilliams
masnwilliams marked this pull request as ready for review August 2, 2026 20:29

@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 high 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 5fef193. Configure here.

Comment thread src/lib/mcp/tools/screenshot.ts Outdated
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.

1 participant