INNER CODE UNIT · Python
state_tool
CursorTouch/Android-MCP · src/android_mcp/__main__.py:309
def state_tool(use_vision: bool = False, use_annotation: bool = True):
require_device()
mobile_state = mobile.get_state(
use_vision=use_vision, use_annotation=use_annotation, as_bytes=True
)
return [mobile_state.tree_state.to_string()] + (
[Image(data=mobile_state.screenshot, format="PNG")] if use_vision else []
)
@mcp.tool(
name="LongClick",
description="Long click on a specific cordinate",
annotations=ToolAnnotations(title="Long Click", destructiveHint=True),
)
def long_click_tool(x: int, y: int):
device = require_device()
device.long_click(x, y)