MCP 工具

這個 MCP 工具會依類別列出團隊模擬器的背景服務,並開啟或關閉它們。

simulator_services 會顯示團隊正在執行的模擬器上執行著哪些 iOS 背景服務,依類別和需要它們的功能分組。使用 enable 或 disable 可以開啟或關閉它們。模擬器啟動時,會關閉 App 很少需要的服務。當 App 需要其中某項服務(例如推播通知、iCloud 或 Siri)時,請在這裡開啟它。沒有 enable 或 disable 時,工具只會讀取。裝置是共用的,所以變更會對所有使用它的人生效。它不是破壞性的,但關閉服務可能導致某些功能無法使用。

開啟的服務可能要等裝置重新啟動或 SpringBoard 重新啟動後才會啟動:這時它會列在 pending 下,而且 restartRequired 為 true。工具從不自行重新啟動任何內容,因為兩種重新啟動都會結束正在執行的 App。若要完成變更,請用 shutdown_simulator 和 start_simulator 重新啟動模擬器。

唯讀 破壞性 冪等
否 否 否

項目

enable 和 disable 的每一項是以下之一:

  • all:清單中的每項服務(用於 disable 時,為每項可以關閉的服務);
  • slim:新模擬器會關閉的那組服務;
  • 類別 ID:widgets、siri、search、icloud、store、pim、web、family、health、photos、apps、messaging、connectivity、telemetry、other、management;
  • 功能 ID:push、storekit、app-store、universal-links、spotlight、siri、icloud、keychain-sync、contacts、calendar、reminders、mail、photos、health、homekit、imessage、widgets、wallet、maps、weather、news、game-center、find-my、screen-time;
  • 某一項服務的 launchd 標籤,即類別的 disabled 中列出的標籤。

請先讀取清單:報告會提供每個 ID 及其名稱,以及關閉後哪些功能會無法使用。

輸入

輸入 類型 必填 預設值 作用
teamId 字串(UUID) 是 — 團隊,來自 list_teams
simulator string 否 團隊的預設裝置 哪種裝置,使用 list_simulators 中的 id
enable 字串清單 否 — 要開啟的 項目。每一項由字母、數字、.、_ 和 - 組成,並以字母或數字開頭
disable 字串清單 否 — 要關閉的 項目,格式相同

結果

讀取(沒有 enable 或 disable):

欄位 說明
ok true
id 裝置在模擬器上的 ID
booted 裝置是否正在執行
source 從正在執行的裝置讀取時為 launchd;從裝置下次啟動所用的設定讀取時為 store
slim 有任何列出的服務處於關閉狀態時為 true
disabledCount, managedCount 列出的服務中有多少項關閉,共多少項
categories 每個都帶有 id、name、description、downside(關閉後哪些功能無法使用)、state(enabled、disabled 或 partial)和 disabled(其中已關閉的服務)
features 每個都帶有 id、name、enabled(它需要的所有服務都已開啟)和 disabled
persistent 變更在裝置重新啟動後是否保留(iOS 18.5 及更新版本)
defaultKeep 新模擬器保持開啟的項目
{
  "ok": true, "id": "…", "booted": true, "source": "launchd", "slim": true,
  "disabledCount": 120, "managedCount": 160,
  "categories": [ { "id": "siri", "name": "Siri & Intelligence", "description": "…", "downside": "…", "state": "disabled", "disabled": ["…"] } ],
  "features": [ { "id": "push", "name": "Push notifications", "enabled": false, "disabled": ["…"] } ],
  "persistent": true, "defaultKeep": ["…"]
}

變更:

欄位 說明
ok true;有些服務無法變更時為 false(其他服務仍維持變更)
id 裝置在模擬器上的 ID
appliedAt now(裝置正在執行)或 next-boot
enabled 已開啟的服務
disabled 已關閉並停止的服務
pending 已開啟但尚未執行的服務,每個都帶有 label 和 reason
failed 無法變更的服務,每個都帶有 label 和 error
restartRequired pending 中有內容在等待重新啟動時為 true

只會列出狀態有變化的服務,所以要求目前狀態會得到空清單。

{ "ok": true, "id": "…", "appliedAt": "now", "enabled": ["…"], "disabled": [], "pending": [], "failed": [], "restartRequired": false }

錯誤

訊息 何時出現 處理方式
enable lists service items such as siri or icloud. enable 不是項目名稱的清單(disable 同理) 傳送 項目 的清單
unknown service “item”: expected all, slim, a category id, a feature id, or a cataloged launchd label … 某一項沒有對應清單中的任何內容 讀取清單並使用其中的 ID
label stays enabled: reason 該服務無法關閉 維持開啟
asked to both enable and disable labels 同一項服務同時出現在兩個清單中 從其中一個清單中移除

另外還有每個模擬器工具都可能傳回的錯誤:請參閱 start_simulator。

範例

{"name": "simulator_services", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "enable": ["push", "icloud"]}}