Skip to main content
Glama
alderban107

hyprland-mcp

by alderban107

mouse_drag

Drag the mouse from specified start to end coordinates while holding a button, enabling precise screen interactions in Hyprland desktop automation.

Instructions

Drag from one position to another.

Args: start_x: Starting X coordinate start_y: Starting Y coordinate end_x: Ending X coordinate end_y: Ending Y coordinate button: Mouse button to hold during drag ("left", "right", "middle")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_xYes
start_yYes
end_xYes
end_yYes
buttonNoleft

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of the drag logic using ydotool to simulate button-down, move, and button-up events.
    async def drag(
        start_x: int,
        start_y: int,
        end_x: int,
        end_y: int,
        button: str = "left",
    ) -> None:
        """Drag from one position to another."""
        require_tool("ydotool")
        down_code = _BUTTON_DOWN.get(button)
        up_code = _BUTTON_UP.get(button)
        if down_code is None:
            raise InputError(f"Unknown button: {button}")
    
        # Move to start position
        await move_cursor(start_x, start_y)
        await asyncio.sleep(0.05)
    
        # Button down
        proc = await asyncio.create_subprocess_exec(
            "ydotool", "click", down_code,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )
        await proc.communicate()
    
        await asyncio.sleep(0.05)
    
        # Move to end position
        await move_cursor(end_x, end_y)
        await asyncio.sleep(0.05)
    
        # Button up
        proc = await asyncio.create_subprocess_exec(
            "ydotool", "click", up_code,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )
        await proc.communicate()
  • MCP tool registration for mouse_drag.
    async def mouse_drag(
        start_x: int,
        start_y: int,
        end_x: int,
        end_y: int,
        button: str = "left",
    ) -> str:
        """Drag from one position to another.
    
        Args:
            start_x: Starting X coordinate
            start_y: Starting Y coordinate
            end_x: Ending X coordinate
            end_y: Ending Y coordinate
            button: Mouse button to hold during drag ("left", "right", "middle")
        """
        from . import input as inp
        await inp.drag(start_x, start_y, end_x, end_y, button)
        return f"Dragged {button} from ({start_x},{start_y}) to ({end_x},{end_y})"
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the action but lacks critical details: whether this requires focus on a specific window, if coordinates are screen-relative or window-relative, what happens if coordinates are out of bounds, whether it's a blocking operation, or if there are rate limits. The description is minimal and doesn't compensate for missing annotations.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The parameter explanations are listed efficiently without redundancy. However, the structure could be improved by integrating parameter details more naturally rather than as a separate 'Args:' section, and some sentences could be more informative.

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 5 parameters with 0% schema coverage and no annotations, the description is incomplete. It covers the basic action and parameters but lacks context on coordinate systems, behavioral constraints, and error conditions. The presence of an output schema (not detailed here) might help, but the description doesn't reference it or explain what the tool returns, leaving gaps for a UI automation tool.

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 0%, so the description must compensate. It lists all 5 parameters with brief explanations, adding meaning beyond the schema's titles. However, it doesn't specify coordinate systems (e.g., pixels, origin), units, or valid ranges for coordinates, nor does it explain the button enum values beyond listing them. The description partially compensates but leaves key semantics unclear.

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 as 'Drag from one position to another,' which is a specific verb (drag) with clear spatial context. It distinguishes itself from sibling tools like mouse_click, mouse_move, and mouse_scroll by specifying a dragging action between coordinates. However, it doesn't explicitly mention what's being dragged (e.g., mouse cursor, UI elements), leaving some ambiguity.

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 no guidance on when to use this tool versus alternatives. It doesn't mention when to choose mouse_drag over mouse_click or mouse_move, nor does it specify prerequisites like needing a window to be focused or coordinates to be within screen bounds. The agent must infer usage from the tool name alone.

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/alderban107/hyprland-mcp'

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