Skip to main content
Glama

Press a hardware or system key

android_key_event

Send Android key events like Back, Home, Enter, and arrow keys to navigate screens, dismiss dialogs, or trigger system actions without needing to tap the screen.

Instructions

Send a key event — Back, Home, Enter, arrows, volume and so on.

Args:

  • key (string): key name without the KEYCODE_ prefix. One of: BACK, HOME, MENU, APP_SWITCH, ENTER, TAB, DEL, FORWARD_DEL, ESCAPE, DPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT, DPAD_CENTER, VOLUME_UP, VOLUME_DOWN, WAKEUP, SLEEP, POWER, CAMERA, SEARCH, MEDIA_PLAY_PAUSE, MEDIA_NEXT, MEDIA_PREVIOUS, PAGE_UP, PAGE_DOWN, MOVE_HOME, MOVE_END

  • serial (string, optional): target device

  • repeat (number): how many times to send it, 1-20 (default: 1)

Returns: { "key": string, "repeat": number, "serial": string }

Examples:

  • Use when: navigating back out of a screen -> key="BACK"

  • Use when: dismissing to the launcher before a cold start -> key="HOME"

  • Use when: submitting a form without tapping -> key="ENTER"

  • Use when: the screen is off and you need to see it -> key="WAKEUP" (POWER toggles, so it can turn the screen back off)

  • Don't use when: typing characters (use android_input_text)

Error Handling:

  • An unrecognised key name is rejected with the list of supported keys

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey name without the KEYCODE_ prefix.
repeatNoHow many times to send it.
serialNoDevice serial from android_list_devices. Optional when exactly one device is connected; required when several are.
Behavior4/5

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

Annotations declare readOnlyHint=false and destructiveHint=false, and the description aligns by describing a send operation. It adds behavioral nuances beyond annotations: POWER toggles and can turn the screen back off, repeat value bounds (1-20), and rejection of unrecognized keys with a supported-key list. This gives the agent useful behavioral expectations without overstepping.

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 well-structured with sections: main purpose, Args, Returns, Examples, Error Handling. It is front-loaded and each section serves a purpose. The key list duplicates the schema enum, which is somewhat redundant, but the examples and error handling make the extra length worthwhile.

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

Completeness5/5

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

The tool has moderate complexity with 3 parameters, but the schema covers all parameters. Annotations provide safety profile. The description adds practical usage guidance, return format (even though no output schema), and error handling. It completely covers what an agent needs to decide when and how to invoke this tool.

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?

Schema coverage is 100% and each parameter already has a description. The description's Args section restates the key list and repeat bounds but adds semantic value through the Use-when examples that tie specific keys to actions. It also clarifies serial's role minimally, though the schema provides richer context (device from android_list_devices, required when multiple). Overall, it adds moderate value beyond the 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 opens with a specific verb+object: 'Send a key event', and the title clarifies 'hardware or system key'. It explicitly lists the key categories (Back, Home, Enter, arrows, volume) and differentiates from android_input_text by stating the don't-use case. This strongly distinguishes it from siblings.

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

Usage Guidelines5/5

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

The description includes explicit 'Use when:' examples mapping scenarios to keys (e.g., navigating back -> BACK, screen off -> WAKEUP) and a clear 'Don't use when: typing characters (use android_input_text)', providing an alternative. It also notes error handling for unrecognized keys, giving clear context.

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/jjs03111/android-build-mcp'

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