start_simulator
這個 MCP 工具會啟動團隊中某種裝置的共用 iOS 模擬器,如果它已在執行則加入,並等待它準備就緒。
start_simulator 會啟動團隊中某種裝置的模擬器,並等待它準備就緒,最長約兩分鐘。如果模擬器已經在執行(可能是 AirBuild App 或團隊的某個 Agent 啟動的),它會加入那個模擬器,而不是再啟動一個:團隊中每種裝置只有一個模擬器,由 App 的模擬器面板、團隊的 Agent 和每個 MCP 用戶端共用。它不會變更裝置上的任何內容,也不會刪除任何內容;再次呼叫不會有影響。
模擬器可能需要幾分鐘才能啟動。如果等待先結束,結果會顯示 starting:一分鐘後再次呼叫 start_simulator。只要有人在使用,模擬器就會維持執行,並在最後一次呼叫任何模擬器工具後約五分鐘內維持執行。執行時間會計入團隊擁有者的方案,與 App 中的模擬器相同。
其他每個 simulator_ 工具都需要模擬器處於執行狀態;它們都會傳回 每個模擬器工具都可能傳回的錯誤 中列出的錯誤。
| 唯讀 | 破壞性 | 冪等 |
|---|---|---|
| 否 | 否 | 是 |
輸入
| 輸入 | 類型 | 必填 | 預設值 | 作用 |
|---|---|---|---|---|
teamId |
字串(UUID) | 是 | — | 團隊,來自 list_teams |
simulator |
string | 否 | 團隊的預設裝置 | 哪種裝置,使用 list_simulators 中的 id |
結果
| 欄位 | 說明 |
|---|---|
id |
裝置的 ID |
name |
裝置的名稱 |
runtime |
它執行的 iOS 版本;僅在 state 為 running 時出現 |
state |
準備就緒時為 running,仍在啟動時為 starting |
note |
僅在 starting 時出現:Still starting. Call start_simulator again in a minute. |
{ "id": "iphone-example", "name": "iPhone", "runtime": "iOS 27.0", "state": "running" }錯誤
| 訊息 | 何時出現 | 處理方式 |
|---|---|---|
| No Simulator id. Offered: ids. | simulator 不是提供的裝置 ID 之一 |
使用 list_simulators 中的 id |
| AirBuild offers no Simulator right now. | 目前沒有提供任何裝置 | 稍後再試 |
| name is not available right now. Choose another device. | 該裝置目前無法啟動 | 從 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 傳回的 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 中的 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,然後重新啟動你的 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. | 具有固定值的輸入收到了其他值 | 使用列出的值之一 |
範例
{"name": "start_simulator", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000"}}