Skip to main content
Glama

press_button

Simulate a button press on a connected Android device to trigger actions like navigation, power, or volume control.

Instructions

Simulate a button press on the connected Android device using an Enum button

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buttonYes

Implementation Reference

  • The main handler function for the 'press_button' tool. It is registered via @mcp.tool() decorator and simulates pressing an Android hardware button using ADB by sending a keyevent based on the Button enum value.
    @mcp.tool()
    def press_button(button: Button) -> str:
        """Simulate a button press on the connected Android device using an Enum button"""
        result = subprocess.run(
            ["adb", "shell", "input", "keyevent", button.value],
            capture_output=True,
            text=True,
        )
        if result.returncode != 0:
            raise RuntimeError(f"Error pressing button '{button.name}': {result.stderr}")
        return f"Button '{button.name}' has been pressed."
  • Enum type 'Button' used as input parameter for press_button tool, defining key codes for various Android buttons.
    class Button(Enum):
        HOME = "3"
        BACK = "4"
        MENU = "82"
        POWER = "26"
        VOLUME_UP = "24"
        VOLUME_DOWN = "25"
        CAMERA = "27"
        ENTER = "66"
  • Registration of the press_button tool using the @mcp.tool() decorator.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions 'using an Enum button' but doesn't explain what the button codes represent, potential side effects (e.g., device state changes), or error conditions. This leaves significant gaps for safe and effective use.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and appropriately sized for a simple tool, though it could be slightly more informative without losing conciseness.

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

Completeness2/5

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

Given no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover behavioral aspects like what happens after pressing the button, error handling, or dependencies on device state, making it inadequate for reliable tool invocation.

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

Parameters2/5

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

Schema description coverage is 0%, and the description adds minimal value beyond the schema. It hints at 'Enum button' but doesn't explain the meaning of the numeric codes (e.g., '3', '4', '82'), leaving parameters semantically unclear. This fails to compensate for the low schema coverage.

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 action ('Simulate a button press') and target ('on the connected Android device'), which is specific and actionable. However, it doesn't differentiate from sibling tools like 'tap' or 'swipe' that also interact with the device interface, missing explicit distinction.

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 like 'tap' or 'swipe', nor does it mention prerequisites (e.g., needing a connected device). It only states the basic function without context for selection.

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/vs4vijay/espresso-mcp'

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