Skip to main content
Glama

remote_macos_mouse_scroll

Scroll at specified coordinates on a remote macOS machine with automatic coordinate scaling. Use environment variables for connection details.

Instructions

Perform a mouse scroll at specified coordinates on a remote MacOs machine, with automatic coordinate scaling. Uses environment variables for connection details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate for mouse position (in source dimensions)
yYesY coordinate for mouse position (in source dimensions)
source_widthNoWidth of the reference screen for coordinate scaling
source_heightNoHeight of the reference screen for coordinate scaling
directionNoScroll directiondown

Implementation Reference

  • Main handler function for remote_macos_mouse_scroll tool. Connects via VNC, scales coordinates from source to target screen, moves mouse, sends Page Up/Down key based on direction for scrolling effect.
    def handle_remote_macos_mouse_scroll(arguments: dict[str, Any]) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Perform a mouse scroll action on a remote MacOs machine."""
        # Use environment variables
        host = MACOS_HOST
        port = MACOS_PORT
        password = MACOS_PASSWORD
        username = MACOS_USERNAME
        encryption = VNC_ENCRYPTION
    
        # Get required parameters from arguments
        x = arguments.get("x")
        y = arguments.get("y")
        source_width = int(arguments.get("source_width", 1366))
        source_height = int(arguments.get("source_height", 768))
        direction = arguments.get("direction", "down")
    
        if x is None or y is None:
            raise ValueError("x and y coordinates are required")
    
        # Ensure source dimensions are positive
        if source_width <= 0 or source_height <= 0:
            raise ValueError("Source dimensions must be positive values")
    
        # Initialize VNC client
        vnc = VNCClient(host=host, port=port, password=password, username=username, encryption=encryption)
    
        # Connect to remote MacOs machine
        success, error_message = vnc.connect()
        if not success:
            error_msg = f"Failed to connect to remote MacOs machine at {host}:{port}. {error_message}"
            return [types.TextContent(type="text", text=error_msg)]
    
        try:
            # Get target screen dimensions
            target_width = vnc.width
            target_height = vnc.height
    
            # Scale coordinates
            scaled_x = int((x / source_width) * target_width)
            scaled_y = int((y / source_height) * target_height)
    
            # Ensure coordinates are within the screen bounds
            scaled_x = max(0, min(scaled_x, target_width - 1))
            scaled_y = max(0, min(scaled_y, target_height - 1))
    
            # First move the mouse to the target location without clicking
            move_result = vnc.send_pointer_event(scaled_x, scaled_y, 0)
    
            # Map of special keys for page up/down
            special_keys = {
                "up": 0xff55,    # Page Up key
                "down": 0xff56,  # Page Down key
            }
    
            # Send the appropriate page key based on direction
            key = special_keys["up" if direction.lower() == "up" else "down"]
            key_result = vnc.send_key_event(key, True) and vnc.send_key_event(key, False)
    
            # Prepare the response with useful details
            scale_factors = {
                "x": target_width / source_width,
                "y": target_height / source_height
            }
    
            return [types.TextContent(
                type="text",
                text=f"""Mouse move to ({scaled_x}, {scaled_y}) {'succeeded' if move_result else 'failed'}
    Page {direction} key press {'succeeded' if key_result else 'failed'}
    Source dimensions: {source_width}x{source_height}
    Target dimensions: {target_width}x{target_height}
    Scale factors: {scale_factors['x']:.4f}x, {scale_factors['y']:.4f}y"""
            )]
        finally:
            # Close VNC connection
            vnc.close()
  • Tool registration in list_tools(), including name, description, and detailed input schema defining parameters for coordinates, scaling, and scroll direction.
    types.Tool(
        name="remote_macos_mouse_scroll",
        description="Perform a mouse scroll at specified coordinates on a remote MacOs machine, with automatic coordinate scaling. Uses environment variables for connection details.",
        inputSchema={
            "type": "object",
            "properties": {
                "x": {"type": "integer", "description": "X coordinate for mouse position (in source dimensions)"},
                "y": {"type": "integer", "description": "Y coordinate for mouse position (in source dimensions)"},
                "source_width": {"type": "integer", "description": "Width of the reference screen for coordinate scaling", "default": 1366},
                "source_height": {"type": "integer", "description": "Height of the reference screen for coordinate scaling", "default": 768},
                "direction": {
                    "type": "string",
                    "description": "Scroll direction",
                    "enum": ["up", "down"],
                    "default": "down"
                }
            },
            "required": ["x", "y"]
        },
    ),
  • Dispatch logic in call_tool() that routes the tool call to the handle_remote_macos_mouse_scroll handler.
    elif name == "remote_macos_mouse_scroll":
        return handle_remote_macos_mouse_scroll(arguments)
  • Input schema defining the parameters: x, y (required), source_width/height (defaults), direction (up/down).
        inputSchema={
            "type": "object",
            "properties": {
                "x": {"type": "integer", "description": "X coordinate for mouse position (in source dimensions)"},
                "y": {"type": "integer", "description": "Y coordinate for mouse position (in source dimensions)"},
                "source_width": {"type": "integer", "description": "Width of the reference screen for coordinate scaling", "default": 1366},
                "source_height": {"type": "integer", "description": "Height of the reference screen for coordinate scaling", "default": 768},
                "direction": {
                    "type": "string",
                    "description": "Scroll direction",
                    "enum": ["up", "down"],
                    "default": "down"
                }
            },
            "required": ["x", "y"]
        },
    ),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'automatic coordinate scaling' and 'environment variables for connection details', which adds some context about how the tool works. However, it doesn't disclose critical behavioral traits like whether this requires specific permissions, potential side effects, error conditions, or what happens if the remote machine is unavailable—significant gaps for a remote control tool.

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

Conciseness5/5

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

The description is a single, well-structured sentence that efficiently conveys the core functionality. Every element earns its place: the action (mouse scroll), target (remote MacOS machine), key feature (automatic coordinate scaling), and implementation detail (environment variables). There's no wasted verbiage or redundancy.

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 moderate complexity (remote control with coordinate scaling), no annotations, and no output schema, the description is somewhat complete but has gaps. It covers the what and how at a high level but lacks details about behavioral expectations, error handling, or return values. For a tool that performs remote actions, more context about reliability and failure modes would be beneficial.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents all 5 parameters. The description adds minimal value beyond the schema—it mentions 'automatic coordinate scaling' which relates to source_width/source_height parameters, but doesn't provide additional semantic context about parameter interactions or usage nuances. This meets the baseline 3 when schema coverage is high.

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

Purpose5/5

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

The description clearly states the specific action ('perform a mouse scroll'), target resource ('on a remote MacOS machine'), and key functionality ('with automatic coordinate scaling'). It distinguishes itself from sibling tools like mouse_click, mouse_move, and mouse_drag_n_drop by specifying the scroll action rather than click, move, or drag operations.

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

Usage Guidelines3/5

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

The description implies usage context through 'remote MacOS machine' and 'environment variables for connection details', suggesting this tool is for remote control scenarios. However, it doesn't explicitly state when to use this versus alternatives like mouse_move or other mouse actions, nor does it provide exclusion criteria or prerequisites beyond the implied remote connection setup.

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