Skip to main content
Glama

Send a key event

key_event

Send a single Android key event to a connected device by named key or keycode 0-300 for navigation, power, volume, and wake/sleep control.

Instructions

Send one key event to the device (input keyevent <code>). Pass a named key (HOME, BACK, ENTER, DEL, MENU, POWER, VOLUME_UP, VOLUME_DOWN, TAB, ESCAPE, APP_SWITCH, WAKEUP, SLEEP) or a raw Android keycode 0-300. Use WAKEUP (or POWER) before driving a screen that may be off, and BACK/HOME to navigate.

Input Schema

NameRequiredDescriptionDefault
keyYesAndroid keycode 0-300, or a named key: HOME, BACK, ENTER, DEL, MENU, POWER, VOLUME_UP, VOLUME_DOWN, TAB, ESCAPE, APP_SWITCH, WAKEUP, SLEEP.
deviceNoDevice serial from list_devices; optional when exactly one device is connected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations declare the mutation profile (readOnly=false, non-idempotent, non-destructive), so those are covered. The description adds useful behavior the annotations cannot: the exact adb mechanism, the difference between named keys and raw keycodes, and the practical caveat that the screen may be off. Error/return behavior is not disclosed, but for a fire-and-forget input injection this is minor.

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?

Front-loaded with the core action and command, followed by the key-format explanation and practical hints. Two sentences, no filler, though the enumerated key list duplicates the schema and could be trimmed.

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?

The tool is simple and single-purpose with no output schema needed; the description covers input format, mechanism, and the main usage caveat. Only the absence of any note about failure modes or return behavior keeps it from a 5.

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 baseline is 3. The description largely restates the schema (named keys plus raw keycode 0-300) and adds only the framing "raw Android keycode" and the wake/navigation hints rather than new parameter-level detail such as what happens with an out-of-range code.

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?

States a specific verb+resource ("Send one key event to the device") and even names the underlying command (`input keyevent <code>`). This clearly distinguishes it from siblings like tap, swipe, and type_text, which also inject input but at a different level.

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?

Gives actionable when-to-use guidance: WAKEUP/POWER before driving a possibly-off screen, BACK/HOME to navigate. It does not explicitly say when to prefer tap/type_text instead of a keycode, so it falls short of full alternative routing but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.