Skip to main content
Glama

press_key

Press hardware, navigation, or raw Android keys on mobile devices, with optional repeat for multiple presses in one call.

Instructions

Press a hardware or navigation key, or send a raw Android keycode. Supports repeat for multiple presses in one call.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

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

Input Schema

NameRequiredDescriptionDefault
keyNoKey to press. Either key or keycode must be provided.
repeatNoPress the key this many times (e.g. delete x10). Default: 1
keycodeNoAndroid keycode number (0-999). Use for keys not in the named list. See https://developer.android.com/reference/android/view/KeyEvent. Ignored on iOS.
observeNoCapture screen state after the action. "on_change" returns the first tree that differs — catches a toast a fixed delay would miss. Default: none
platformNoTarget platform. Inferred if omitted.
device_idNoDevice ID. Omit for the connected device.
observe_delay_msNoMs to wait before observing. Default: 500
observe_stabilizeNoWait for the UI to settle instead of a fixed delay. Default: false

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

B3.1/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the safety profile is partly supplied. The description adds only that repeat batches multiple presses in one call, and says nothing about side effects of specific keys (power, paste, delete), platform-dependent behavior, or what the call returns.

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?

Two short sentences, front-loaded with the core action and with no filler. It is efficient, though its brevity leaves gaps that the 8-parameter schema has to fill alone.

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?

For a tool with 8 parameters, zero required fields, and a nuanced observe/observe_delay_ms/observe_stabilize subsystem, the description covers almost none of it. An agent must read the entire schema to learn that key or keycode is mandatory, that platform is inferred, and that keycode is ignored on iOS.

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 enum values, keycode range, repeat bounds, and observe modes are already fully documented. The description restates the key/keycode duality and repeat without adding format or selection guidance beyond the schema, making the baseline 3 appropriate.

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 names a specific verb (press) and resource (hardware/navigation key, or raw Android keycode), which is enough to separate it from siblings such as tap, long_press, and type_text. It does not explicitly name an alternative, but the action is unambiguous.

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

Usage Guidelines3/5

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

There is an implicit usage distinction between pressing a named key and sending a raw Android keycode, and the repeat capability hints at batching repeated presses. However, there is no explicit when-to-use guidance versus siblings (e.g. type_text vs the paste key, tap vs enter) and no stated exclusions or prerequisites.

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