mobile_take_screenshot
Capture the current screen display on an Android device to obtain a visual reference for analysis or documentation.
Instructions
Take a screenshot of the current Android screen.
Returns an image object that can be viewed by the LLM.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "mobile_take_screenshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:270-270 (registration)The @mcp.tool() decorator registers the mobile_take_screenshot function as an MCP tool.
@mcp.tool() - main.py:271-287 (handler)The handler function that captures the Android screen screenshot using uiautomator2, saves it as PNG bytes in memory, and returns it as a FastMCP Image object.
def mobile_take_screenshot() -> Image: """Take a screenshot of the current Android screen. Returns an image object that can be viewed by the LLM. """ if device is None: return "Error: Device not initialized. Please call mobile_init() first to establish connection with Android device." try: screenshot = device.screenshot() buf = io.BytesIO() screenshot.save(buf, format="PNG") img_bytes = buf.getvalue() return Image(data=img_bytes, format="png") except Exception as e: return f"Error taking screenshot: {str(e)}"