# simulator_button

> 这个 MCP 工具按下团队模拟器上的硬件按钮：主屏幕、锁定、音量或 App 切换器。

Source: https://air.build/cn/docs/mcp-tools/simulator_button/

`simulator_button` 在团队正在运行的模拟器上按下一个硬件按钮并松开：`home` 回到主屏幕，`lock`（也叫 `power`）锁定或唤醒屏幕，`volume-up` 和 `volume-down` 调节音量，`app-switcher` 打开 App 切换器。`duration` 会按住按钮，例如长按 `lock`。它不会退出或启动 App；要让 App 回到前台，请使用 [simulator_launch_app](https://air.build/cn/docs/mcp-tools/simulator_launch_app/)。

| 只读 | 破坏性 | 幂等 |
| --- | --- | --- |
| 否 | 否 | 否 |

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | 是 | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) |
| `simulator` | string | 否 | 团队的默认设备 | 哪种设备，使用 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/#result) 中的 `id` |
| `button` | 字符串：`home`、`lock`、`power`、`volume-up`、`volume-down`、`app-switcher` | 是 | — | 按钮。`power` 与 `lock` 相同 |
| `duration` | 数字，0 到 60 | 否 | 短按 | 按住的秒数 |

## 结果

| 字段 | 说明 |
| --- | --- |
| `ok` | `true` |

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

## 错误

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| button is required. | 缺少 `button` | 发送一个按钮 |
| button must be one of home, lock, power, volume-up, volume-down, app-switcher. | 其他名称 | 使用以下之一 |
| duration must be a number from 0 to 60. | `duration` 超出范围 | 发送 0 到 60 |

另外还有每个模拟器工具都可能返回的错误：见 [start_simulator](https://air.build/cn/docs/mcp-tools/start_simulator/#device-errors)。

## 示例

```json
{"name": "simulator_button", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "button": "home"}}
```
