Skip to main content
Glama

Press key

press_key

Simulate Android hardware or navigation key presses by key name or raw keycode to submit forms, dismiss the keyboard, navigate back, control power/volume, and optionally verify whether the UI changed.

Instructions

Press a hardware/navigation key by name (enter, back, home, menu, tab, del, escape, up, down, left, right, dpad_center, app_switch, search, power, wakeup, sleep, volume_up, volume_down, ...) or a raw Android keycode number. Handy to submit a form (enter), dismiss the keyboard (escape), or go back (back). To turn the screen ON use wakeup (not power, which toggles and may sleep an awake screen); sleep turns it off. A key can be silently consumed with no effect (e.g. back while a biometric prompt is up) — pass verify_change=true to get ui_changed: true/false instead of guessing. Batching several presses (or a press whose timing matters relative to other actions) belongs in run_sequence, not in separate calls.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "key": "<key>"
    },
    "name": "press_key"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYesKey name (enter, back, home, menu, tab, del, escape, up, down, left, right, ...) or a raw keycode number.
serialNoTarget device serial (adb -s). Optional when exactly one device is attached.
verify_changeNoAlso report whether the UI hierarchy changed after the key press (ui_changed: true/false). Costs two extra hierarchy reads (~2-3s); use when the key may be silently consumed (e.g. back while a biometric prompt is up).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the supplied annotations, it discloses important behavioral caveats: a key may be silently consumed with no effect, verify_change=true reports ui_changed at the cost of extra hierarchy reads, and power toggles the screen rather than reliably waking it. This adds meaningful operational context for a key-press tool with minimal annotation coverage.

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 front-loaded with the core action and remains dense with useful guidance. It is somewhat long and repeats the key-name list already present in the schema, but every sentence contributes operational value and no major filler is present.

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?

For a three-parameter tool with no output schema, the description is complete: it explains accepted key forms, key behavioral edge cases, the verify_change result, and the batching alternative. An agent has enough information to choose and invoke the tool correctly.

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 description coverage is 100%, so the schema already documents key, serial, and verify_change. The description still adds useful semantics beyond the schema, especially the distinction between wakeup, sleep, and power, and the silent-consumption scenario for verify_change; it does not add anything for serial, which keeps it from a 5.

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 states a specific verb and resource: pressing a hardware/navigation key by name or raw Android keycode. It lists concrete key names (enter, back, home, power, wakeup, sleep) and distinguishes behavior from siblings by naming run_sequence for batching and clarifying power vs. wakeup.

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?

It gives explicit when-to-use guidance: enter to submit a form, escape to dismiss the keyboard, back to go back. It also names alternatives and exclusions: use wakeup rather than power to turn the screen on, sleep to turn it off, and run_sequence for batching or timing-sensitive presses.

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