Skip to main content
Glama

key_event

Send Android keycodes such as HOME, BACK, ENTER, or VOLUME_UP to a device by name or numeric value, enabling automated navigation and control.

Instructions

Send a key event to the device. Supports keycodes like HOME, BACK, ENTER, VOLUME_UP, etc.

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": "key_event"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoAlias for keycode
serialNoDevice serial number
keycodeNoKeycode name (e.g., 'HOME', 'BACK') or numeric value

Output Schema

NameRequiredDescriptionDefault
messageYesHuman-readable description of the action performed
successYesWhether the input action was dispatched to the device

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv3.0.1
    • removedInput schema / properties / key / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / key / type
      Added value: +[
      +  "string",
      +  "number"
      +]
    • removedInput schema / properties / keycode / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / keycode / type
      Added value: +[
      +  "string",
      +  "number"
      +]
  2. First observedv0.4.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and openWorldHint=true, so the agent knows this mutates external device state and is repeat-sensitive. Beyond that the description adds nothing about needing a connected device/session, which UI element receives focus, or that the effect depends on the current app. Useful but thin given how stateful key injection is.

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, purpose first, examples second, with no filler. Slightly clipped in that the keycode list is doing the parameter explanation rather than the behavior explanation.

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?

An output schema exists and annotations cover the safety profile, so the description needn't explain returns or risk. The remaining gap is small but real: no mention of session/connection requirements for a device-targeted action, which matters because 'serial' is optional and there are multiple device-facing siblings.

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 applies; the description's keycode examples echo what the schema already says for keycode ('HOME', 'BACK'). It does not clarify the unexplained overlap between the 'key' alias and 'keycode', nor that all three parameters are optional and what happens if none is supplied.

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?

Uses a specific verb+resource: "Send a key event to the device," and enumerates example keycodes (HOME, BACK, ENTER, VOLUME_UP), which makes the tool concrete. It doesn't distinguish itself from near-neighbors like input_text or long_press, so sibling differentiation is left to the agent.

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 never states when to use this versus input_text (typing text) or long_press (held press), and gives no prerequisites such as an active session or foreground app. Usage is only implied by the tool's purpose, matching the calibration case of a bare 'update X settings' line.

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