Skip to main content
Glama

remote_macos_get_screen

Capture screenshots from remote macOS systems to monitor desktop activity or troubleshoot issues remotely.

Instructions

Connect to a remote MacOs machine and get a screenshot of the remote desktop. Uses environment variables for connection details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for the 'remote_macos_get_screen' tool. Uses environment variables to connect via VNC, calls capture_vnc_screen helper, base64 encodes the PNG screenshot, and returns ImageContent with dimensions text.
    async def handle_remote_macos_get_screen(arguments: dict[str, Any]) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Connect to a remote MacOs machine and get a screenshot of the remote desktop."""
        # Use environment variables
        host = MACOS_HOST
        port = MACOS_PORT
        password = MACOS_PASSWORD
        username = MACOS_USERNAME
        encryption = VNC_ENCRYPTION
    
        # Capture screen using helper method
        success, screen_data, error_message, dimensions = await capture_vnc_screen(
            host=host, port=port, password=password, username=username, encryption=encryption
        )
    
        if not success:
            return [types.TextContent(type="text", text=error_message)]
    
        # Encode image in base64
        base64_data = base64.b64encode(screen_data).decode('utf-8')
    
        # Return image content with dimensions
        width, height = dimensions
        return [
            types.ImageContent(
                type="image",
                data=base64_data,
                mimeType="image/png",
                alt_text=f"Screenshot from remote MacOs machine at {host}:{port}"
            ),
            types.TextContent(
                type="text",
                text=f"Image dimensions: {width}x{height}"
            )
        ]
  • Tool call dispatch in @server.call_tool() that routes requests for 'remote_macos_get_screen' to the handler function.
    if name == "remote_macos_get_screen":
        return await handle_remote_macos_get_screen(arguments)
  • MCP Tool registration in @server.list_tools(), defining name, description, and empty input schema (no parameters required).
    types.Tool(
        name="remote_macos_get_screen",
        description="Connect to a remote MacOs machine and get a screenshot of the remote desktop. Uses environment variables for connection details.",
        inputSchema={
            "type": "object",
            "properties": {}
        },
    ),
  • Key helper function that performs VNC connection using Apple Authentication, captures the screen framebuffer (handling RAW/COPY_RECT encodings), scales the image to 1366x768 PNG, and returns bytes with dimensions.
    async def capture_vnc_screen(host: str, port: int, password: str, username: Optional[str] = None,
                                 encryption: str = "prefer_on") -> Tuple[bool, Optional[bytes], Optional[str], Optional[Tuple[int, int]]]:
        """Capture a screenshot from a remote MacOs machine.
    
        Args:
            host: remote MacOs machine hostname or IP address
            port: remote MacOs machine port
            password: remote MacOs machine password
            username: remote MacOs machine username (optional)
            encryption: Encryption preference (default: "prefer_on")
    
        Returns:
            Tuple containing:
            - success: True if the operation was successful
            - screen_data: PNG image data if successful, None otherwise
            - error_message: Error message if unsuccessful, None otherwise
            - dimensions: Tuple of (width, height) if successful, None otherwise
        """
        logger.debug(f"Connecting to remote MacOs machine at {host}:{port} with encryption: {encryption}")
    
        # Initialize VNC client
        vnc = VNCClient(host=host, port=port, password=password, username=username, encryption=encryption)
    
        try:
            # Connect to remote MacOs machine
            success, error_message = vnc.connect()
            if not success:
                detailed_error = f"Failed to connect to remote MacOs machine at {host}:{port}. {error_message}\n"
                detailed_error += "This VNC client only supports Apple Authentication (protocol 30). "
                detailed_error += "Please ensure the remote MacOs machine supports this protocol. "
                detailed_error += "For macOS, enable Screen Sharing in System Preferences > Sharing."
                return False, None, detailed_error, None
    
            # Capture screen
            screen_data = vnc.capture_screen()
    
            if not screen_data:
                return False, None, f"Failed to capture screenshot from remote MacOs machine at {host}:{port}", None
    
            # Save original dimensions for reference
            original_dims = (vnc.width, vnc.height)
    
            # Scale the image to FWXGA resolution (1366x768)
            target_width, target_height = 1366, 768
    
            try:
                # Convert bytes to PIL Image
                image_data = io.BytesIO(screen_data)
                img = Image.open(image_data)
    
                # Resize the image to the target resolution
                scaled_img = img.resize((target_width, target_height), Image.Resampling.LANCZOS)
    
                # Convert back to bytes
                output_buffer = io.BytesIO()
                scaled_img.save(output_buffer, format='PNG')
                output_buffer.seek(0)
                scaled_screen_data = output_buffer.getvalue()
    
                logger.info(f"Scaled image from {original_dims[0]}x{original_dims[1]} to {target_width}x{target_height}")
    
                # Return success with scaled screen data and target dimensions
                return True, scaled_screen_data, None, (target_width, target_height)
    
            except Exception as e:
                logger.warning(f"Failed to scale image: {str(e)}. Returning original image.")
                # Return the original image if scaling fails
                return True, screen_data, None, original_dims
    
        finally:
            # Close VNC connection
            vnc.close()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool connects remotely and uses environment variables, but doesn't mention behavioral traits like authentication needs, potential latency, error handling, or what the output looks like (e.g., image format). For a remote operation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, consisting of two sentences that directly state the purpose and connection method. There's no wasted text, and it efficiently communicates key information, though it could be slightly more structured (e.g., separating prerequisites).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (remote operation) and lack of annotations and output schema, the description is moderately complete. It covers the basic action and connection method but misses details like output format, error cases, or dependencies. For a tool with no structured support, it's adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameters need documentation. The description adds context about environment variables for connection details, which compensates for the lack of parameters. This provides useful semantic information beyond the schema, earning a high score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Connect to a remote MacOs machine and get a screenshot of the remote desktop.' It specifies the verb ('get a screenshot') and resource ('remote desktop'), but doesn't explicitly distinguish it from sibling tools (e.g., mouse actions, application opening). This makes it clear but not fully differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance: it mentions using environment variables for connection details, which implies prerequisites. However, it doesn't specify when to use this tool versus alternatives (e.g., other remote tools for different actions) or any exclusions. This lack of explicit context guidance limits its helpfulness.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/baryhuang/mcp-remote-macos-use'

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