Skip to main content
Glama
alderban107

hyprland-mcp

by alderban107

click_text

Locate and click text on screen using OCR, screenshot, and mouse automation in Hyprland desktop environments.

Instructions

Find text on screen and click it — screenshot + OCR + click in one call.

By default, searches only the active window for better accuracy and speed.

Args: target: Text to find and click (case-insensitive) button: Mouse button ("left", "right", "middle") double: Whether to double-click monitor: Limit search to a specific monitor window: Limit search to a specific window (e.g. "class:discord") region: Limit search to a region "X,Y WxH" occurrence: Which match to click if multiple found (1 = first/best, 2 = second, etc.) scope: "auto" (default) searches the active window. "full" searches entire desktop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
buttonNoleft
doubleNo
monitorNo
windowNo
regionNo
occurrenceNo
scopeNoauto

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'click_text' tool is defined here as an MCP tool. It handles the logic of capturing the screen, performing OCR, finding the text coordinates, and executing the click input.
    @mcp.tool()
    async def click_text(
        target: str,
        button: str = "left",
        double: bool = False,
        monitor: str | None = None,
        window: str | None = None,
        region: str | None = None,
        occurrence: int = 1,
        scope: str = "auto",
    ) -> str:
        """Find text on screen and click it — screenshot + OCR + click in one call.
    
        By default, searches only the active window for better accuracy and speed.
    
        Args:
            target: Text to find and click (case-insensitive)
            button: Mouse button ("left", "right", "middle")
            double: Whether to double-click
            monitor: Limit search to a specific monitor
            window: Limit search to a specific window (e.g. "class:discord")
            region: Limit search to a region "X,Y WxH"
            occurrence: Which match to click if multiple found (1 = first/best, 2 = second, etc.)
            scope: "auto" (default) searches the active window. "full" searches entire desktop.
        """
        from . import screenshot as ss, ocr, input as inp
    
        if scope == "full" and not (monitor or window or region):
            png_bytes, origin_x, origin_y = await ss.capture_raw()
        else:
            png_bytes, origin_x, origin_y = await _auto_scope_capture(
                monitor, window, region,
            )
    
        boxes = ocr.extract_boxes(png_bytes)
        matches = ocr.find_text(boxes, target)
    
        if not matches:
            all_text = ocr.extract_text(png_bytes)
            preview = all_text[:500] + "..." if len(all_text) > 500 else all_text
            return f"Could not find '{target}' on screen.\n\nOCR detected text:\n{preview}"
    
        if occurrence > len(matches):
            return (
                f"Only found {len(matches)} match(es) for '{target}', "
                f"but occurrence={occurrence} requested."
            )
    
        match = matches[occurrence - 1]
        screen_x = match["x"] + origin_x + match["w"] // 2
        screen_y = match["y"] + origin_y + match["h"] // 2
    
        await inp.move_cursor(screen_x, screen_y)
        await inp.click(button, double=double)
    
        kind = "Double-clicked" if double else "Clicked"
        return (
            f"{kind} '{match['text']}' at ({screen_x}, {screen_y}) "
            f"[conf: {match['conf']}%]"
        )
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it's a write/mutation tool (implied by 'click'), describes the default search scope ('active window'), mentions accuracy/speed trade-offs, and explains what happens with multiple matches ('occurrence' parameter). It doesn't cover error handling or permissions, but provides substantial operational context.

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 perfectly structured: a front-loaded summary sentence, a key behavioral note, then a well-organized parameter section. Every sentence earns its place with no redundancy. The two-sentence top section efficiently conveys core functionality and default behavior.

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

Completeness4/5

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

For a complex 8-parameter tool with no annotations but an output schema, the description is nearly complete: it explains purpose, behavior, and all parameters thoroughly. The output schema presumably handles return values, so the description appropriately focuses on inputs and operation. It could mention error cases (e.g., no match found) but covers most essential context.

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

Parameters5/5

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

With 0% schema description coverage for 8 parameters, the description compensates fully by explaining every parameter in the Args section with clear semantics: 'target: Text to find and click (case-insensitive)', 'occurrence: Which match to click if multiple found', etc. This adds crucial meaning beyond the bare schema.

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 tool's purpose with specific verbs ('Find text on screen and click it') and details the multi-step process ('screenshot + OCR + click in one call'). It distinguishes itself from siblings like 'find_text_on_screen' (which only finds) and 'mouse_click' (which only clicks), making the combined functionality explicit.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('searches only the active window for better accuracy and speed' and 'scope: "auto" (default) searches the active window. "full" searches entire desktop.'). However, it doesn't explicitly mention when not to use it or name alternatives like 'find_text_on_screen' + 'mouse_click' for separate operations.

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