Repository navigation
fix(mcp): preserve viewport screenshot size by default - #2916
Merged
Merged
Conversation
Contributor
|
Contributor
✅ Tests passed: 2474/2477Ran 11 of 16 suites (5 not affected by this change).
|
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 screenshot tool no longer silently shrinks an omitted
sizeinto 1024x768. Rust and TypeScript now capture the current CSS layout viewport withclip.scale = 1; explicit bounds keep the aspect ratio and never upscale.Sizing decisions:
sizebox therefore caps CSS dimensions; encoded dimensions include device density. The tool descriptions and clip comments make that distinction explicit.{}is uncapped. Supplied dimensions retain the 1..4096 validation. Removed RustDefault,default_width/default_height, and the TS default-size constant.fullPageretains its existing capture path and ignoressize. The Rust SDK/runhelper delegates to the same screenshot tool; its instructions now state the rule. The TS server agrees, and a repository search found no other documentation/skills advertising the old default.The CDP viewport contract defines CSS/DIP geometry; the image dimensions below were measured from actual returned PNG bytes.
Evidence
Before: the existing screenshot-tool regression expected scale 1 for a 2048x1536 viewport and failed with scale 0.5. After: it passes with scale 1.
Built this worktree's
browseros-claw-server-rs, connected it over MCP stdio to running BrowserOS neo (Chrome/155.0.8311.26), and calledscreenshotfour ways in a task-owned background fixture tab. Explicit box: 1024x768; width-only: 1024; fullPage also passed width 1 to verify it is ignored. DPR 2 was emulated only on that target; the attached display was DPR 1.All captures left innerWidth, innerHeight, DPR and scroll offsets unchanged. fullPage used size.width=1 and matched the unchanged direct-CDP full-page baseline. DPR 2 is emulated on this task-owned target; the attached display is DPR 1.
cargo check -p browseros-mcpcargo clippy -p browseros-mcp --all-targets -- -D warningscargo test -p browseros-mcp: 119 unit and 4 integration tests passed.cargo build -p claw-serverbun run check: passed; existing non-fatal lint/Fallow warnings remain.bun run test: initial complete suite passed (2144 tests), including the 18-case real-browser MCP smoke suite. After integrating current main, the only local failure was an unchanged model-picker test exceeding its five-second timeout. That test and both screenshot regression files passed withbun test --timeout 30000(66 tests); no unrelated source was changed.76cb765639753cd582da0bfa2b8f630262ad473b. Rust checks, build, and all eight live captures were repeated after integration and passed.git diff --checkMerge Danger
Door: two-way, reversible by reverting this change.
Blast Radius: Rust/TS MCP screenshots and the Rust SDK helper. Omitted/partial sizes can produce larger images; clients wanting the old cap can explicitly pass both dimensions. JPEG quality, formats, and full-page capture are unchanged.