feat: expose use_annotation parameter in Snapshot tool#95
Merged
Jeomon merged 1 commit intoCursorTouch:mainfrom Mar 9, 2026
Merged
Conversation
Add use_annotation parameter to the Snapshot (state_tool) function, allowing MCP clients to control whether bounding box annotations are drawn on screenshots. When use_vision=True, the desktop.get_state() method supports a use_annotation parameter that controls screenshot rendering: - use_annotation=True (default): draws colored bounding boxes around detected UI elements via get_annotated_screenshot() - use_annotation=False: returns a clean screenshot via get_screenshot() Previously, this parameter was not exposed through the MCP Snapshot tool, forcing all vision-enabled screenshots to include bounding box overlays. This can be problematic for AI agents using Computer Use, as the colored rectangles can obscure text and UI elements the agent needs to read. This change adds use_annotation as an optional parameter (default: True) to maintain backward compatibility while giving clients the ability to request clean screenshots when needed.
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
Expose the existing
use_annotationparameter fromDesktop.get_state()through the MCPSnapshottool, allowing clients to control whether bounding box annotations are drawn on screenshots.Problem
When
use_vision=True, theSnapshottool always returns screenshots with colored bounding boxes drawn around detected UI elements (viaget_annotated_screenshot()). TheDesktop.get_state()method already supports ause_annotationparameter to control this behavior, but it was not exposed through the MCP tool interface.This is particularly problematic for AI agents using Computer Use (e.g., Claude, GPT-4V), where the colored rectangles can:
Solution
Add
use_annotation: bool | str = Trueas an optional parameter to theSnapshottool (state_tool), and pass it through todesktop.get_state().Changes (4 lines added, 1 modified):
use_annotation: bool | str = Trueparameteruse_visionanduse_dom)use_annotationthrough todesktop.get_state()Behavior:
use_annotation=True(default): Draws colored bounding boxes around UI elements — no change from current behavioruse_annotation=False: Returns a clean screenshot without overlaysBackward Compatibility
Default value is
True, preserving existing behavior. No breaking changes for current users.Testing
Tested with a real-world AI automation system running Claude Computer Use across multiple Windows machines. Setting
use_annotation=Falsesignificantly improved the agent's ability to read UI elements and interact with the desktop accurately.