[computer-server] Fix coordinate scaling initialization in MCP screenshot tool - #936
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ddupont808
approved these changes
Jan 29, 2026
f-trycua
approved these changes
Jan 29, 2026
This was referenced Jul 31, 2026
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.
Related #898 (Issue 2)
Fixes a critical bug where coordinates from grounding models were never scaled back to actual device resolution, causing clicks to land at completely wrong locations.
The Problem:
(414, 1069))The Fix:
_configure_scaling()after auto-resize to initialize scale factors(414, 1069)→(983, 2538)Changes:
computer_server/mcp_server.py: Added 4 lines after auto-resize logic to initialize coordinate scalingVisual Demonstration
Original Screenshot (1440x3040)
Android home screen with Chrome and Messages icons at the bottom
Reproduction & Testing
Run this script to visualize the bug and fix:
demo_coordinate_fix.py (click to expand)
Run with:
Output:
Results
Coordinate Scaling Comparison
1. Model Prediction
(Resized 606x1280)
Grounding model sees resized screenshot and predicts Chrome icon at
(414, 1069)2. Without Fix (Bug)
(Original 1440x3040)
Coordinates sent directly to device:
(414, 1069)❌ Click lands 1575px away from target
3. With Fix
(Original 1440x3040)
Coordinates scaled to device:
(983, 2538)✅ Click lands on Chrome icon
Technical Details
Before (Bug):
After (Fixed):
Impact: