Skip to main content
Glama

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

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)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/erichung9060/Android-Mobile-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server