# simulator_key

> The MCP tool that presses one key, with optional modifiers, on the Team's Simulator's hardware keyboard.

Source: https://air.build/docs/mcp-tools/simulator_key/

`simulator_key` presses one key on the Team's running Simulator's hardware keyboard, optionally with modifier keys held, and releases it. Use it for Return, Delete, Tab, Escape, arrows and shortcuts such as Command-V. The key goes to whatever has focus. For text use [simulator_type_text](https://air.build/docs/mcp-tools/simulator_type_text/); for the Home, lock and volume buttons use [simulator_button](https://air.build/docs/mcp-tools/simulator_button/).

Keys are named by their W3C `KeyboardEvent.code`, which is case-sensitive: for example `KeyA`, `Digit1`, `Enter`, `Escape`, `Backspace`, `Tab`, `ArrowUp`, `ArrowDown`. A code names the key, not the character: `KeyA` with `shift` gives "A".

| Read-only | Destructive | Idempotent |
| --- | --- | --- |
| No | No | No |

## Inputs

| Input | Type | Required | Default | What it does |
| --- | --- | --- | --- | --- |
| `teamId` | string (UUID) | Yes | — | The Team, from [list_teams](https://air.build/docs/mcp-tools/list_teams/) |
| `simulator` | string | No | The Team's default device | Which device, by `id` from [list_simulators](https://air.build/docs/mcp-tools/list_simulators/#result) |
| `code` | string | Yes | — | The key, as a W3C `KeyboardEvent.code` |
| `modifiers` | list of `shift`, `control`, `option`, `command` | No | None | Keys held while it is pressed |
| `duration` | number, 0 to 60 | No | A short press | Seconds to hold the key |

## Result

| Field | What |
| --- | --- |
| `ok` | `true` |

```json
{ "ok": true }
```

## Errors

| Message | When | What to do |
| --- | --- | --- |
| code is required. | `code` is missing | Send a key code |
| modifiers must be among shift, control, option, command. | `modifiers` is not a list, or has another name (`ctrl`, `cmd`, `alt` and `meta` are not accepted) | Use the four names |
| duration must be a number from 0 to 60. | `duration` out of range | Send 0 to 60 |

An unknown `code` is refused by the Simulator in its own words. Plus the errors every Simulator tool can return: see [start_simulator](https://air.build/docs/mcp-tools/start_simulator/#device-errors).

## Example

```json
{"name": "simulator_key", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "code": "KeyV", "modifiers": ["command"]}}
```
