# start_simulator

> 这个 MCP 工具启动团队中某种设备的共享 iOS 模拟器，如果它已在运行则加入，并等待它准备就绪。

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

`start_simulator` 启动团队中某种设备的模拟器，并等待它准备就绪，最长约两分钟。如果模拟器已经在运行（可能是 AirBuild App 或团队的某个智能体启动的），它会加入那个模拟器，而不是再启动一个：团队中每种设备只有一个模拟器，由 App 的模拟器面板、团队的智能体和每个 MCP 客户端共享。它不更改设备上的任何内容，也不删除任何内容；再次调用不会有影响。

模拟器可能需要几分钟才能启动。如果等待先结束，结果会显示 `starting`：一分钟后再次调用 `start_simulator`。只要有人在使用，模拟器就会保持运行，并在最后一次调用任何模拟器工具后约五分钟内保持运行。运行时间计入团队拥有者的方案，与 App 中的模拟器相同。

其他每个 `simulator_` 工具都需要模拟器处于运行状态；它们都会返回 [每个模拟器工具都可能返回的错误](https://air.build/cn/docs/mcp-tools/start_simulator/#device-errors) 中列出的错误。

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

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `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` |

## 结果

| 字段 | 说明 |
| --- | --- |
| `id` | 设备的 ID |
| `name` | 设备的名称 |
| `runtime` | 它运行的 iOS 版本；仅在 `state` 为 `running` 时出现 |
| `state` | 准备就绪时为 `running`，仍在启动时为 `starting` |
| `note` | 仅在 `starting` 时出现：`Still starting. Call start_simulator again in a minute.` |

```json
{ "id": "iphone-example", "name": "iPhone", "runtime": "iOS 27.0", "state": "running" }
```

## 错误

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| No Simulator _id_. Offered: _ids_. | `simulator` 不是提供的设备 ID 之一 | 使用 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/) 中的 `id` |
| AirBuild offers no Simulator right now. | 目前没有提供任何设备 | 稍后再试 |
| _name_ is not available right now. Choose another device. | 该设备目前无法启动 | 从 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/) 中选择另一种设备 |
| Cloud Builds and Previews are used up for this billing period, and you have no credits left. Buy credits or change your plan to keep going. | 团队拥有者的方案已没有剩余的模拟器时间。加入已经在运行的模拟器仍然可以 | 由团队拥有者购买积分或更换方案 |
| Team not found. | 你不是该团队的成员 | 使用 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) 返回的 `teamId` |
| This account's Simulator time and credits are used up. | 模拟器在启动期间因团队拥有者的方案用尽而停止 | 由团队拥有者购买积分或更换方案 |
| _device_ is no longer offered. Start the Simulator again to use another device. | 该设备在启动期间被撤下 | 启动另一种设备 |
| The _name_ Simulator could not start. Try again. | 启动失败，但没有说明原因 | 再次调用 `start_simulator` |

### 每个模拟器工具都可能返回的错误

每个操作正在运行的模拟器的工具（所有 `simulator_` 工具）都可能返回这些错误。模拟器自身的拒绝会以它自己的措辞返回，如果有，后面还会附上详细信息和 `Hint:`；对于下面的常见情况，工具会补充处理方法。

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| The _name_ Simulator is not running. Start it with start_simulator. | 团队中该设备的模拟器处于关闭状态 | 调用 `start_simulator` |
| The _name_ Simulator is still starting. Call start_simulator to wait for it. | 它正在启动 | 调用 `start_simulator`，它会等待 |
| No Simulator _id_. Offered: _ids_. | `simulator` 不是提供的设备 ID | 使用 [list_simulators](https://air.build/cn/docs/mcp-tools/list_simulators/) 中的 `id` |
| Could not reach the Simulator. It may be restarting — try again, or call start_simulator. | 模拟器没有响应 | 重试；如果一直失败，调用 `start_simulator` |
| _…_ The connection to the Simulator dropped; try again. | 调用期间连接中断 | 重试 |
| The Simulator answered _status_. | 模拟器拒绝了但没有给出说明 | 检查输入后重试 |
| _…_ Call simulator_heal to take input back (it restarts SpringBoard, so relaunch the app after). | 输入正被 Xcode 的 Device Hub 占用：消息开头会说明这一点，点按、输入和按钮会报告成功但没有任何效果 | 调用 [simulator_heal](https://air.build/cn/docs/mcp-tools/simulator_heal/)，然后重新启动你的 App |
| _…_ The app in front is busy; try again in a few seconds. | 前台 App 没有及时提供辅助功能数据 | 几秒后重试 |
| _key_ must be a number from _min_ to _max_. | 数字输入超出范围，或不是数字 | 发送工具页面上给出的范围内的数字 |
| _key_ must be one of _values_. | 具有固定取值的输入收到了其他值 | 使用列出的值之一 |

## 示例

```json
{"name": "start_simulator", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000"}}
```
