# appstore_prepare_version

> 建立或編輯正在準備的 App Store 版本：版本號碼、建置版本、發布方式、分階段發布、版權資訊，以及 App 審查所需的內容。

Source: https://air.build/tw/docs/mcp-tools/appstore_prepare_version/

建立或編輯正在為 App Store 準備的版本：版本號碼、隨版本推出的建置版本、發布方式（手動、核准後立即發布，或在指定日期發布，可選擇在 7 天內分階段發布）、版權資訊，以及 App 審查所需的內容（聯絡人、示範帳號、備註）。只有傳送的輸入會變更。

沒有正在準備的版本時，它會建立一個，此時 `versionString` 為必填。已有正在準備的版本時，傳入不同的 `versionString` 會變更它的版本號碼。它不會更動商店資訊文字或截圖（請參閱 [appstore_update_store_listing](https://air.build/tw/docs/mcp-tools/appstore_update_store_listing/) 和 [appstore_upload_screenshots](https://air.build/tw/docs/mcp-tools/appstore_upload_screenshots/)），也不會提交（請參閱 [appstore_submit_for_review](https://air.build/tw/docs/mcp-tools/appstore_submit_for_review/)）。

| 唯讀 | 破壞性 | 冪等 |
| --- | --- | --- |
| 否 | 否 | 是 |

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字串（UUID） | yes | — | 團隊，來自 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/)。 |
| `projectId` | 字串（UUID） | 與 `appId` 二擇一 | — | 這個 App 所屬的專案，來自 [list_projects](https://air.build/tw/docs/mcp-tools/list_projects/)：這是指定 App 的一般方式。App 是 App Store Connect 上 bundle ID 與該專案建置的 bundle ID 相同的那一個。兩者都傳送時，會使用 `projectId`。 |
| `appId` | string | 與 `projectId` 二擇一 | — | 來自 [appstore_list_apps](https://air.build/tw/docs/mcp-tools/appstore_list_apps/) 的 App Store Connect App ID，用於沒有專案建置的 App。 |
| `appleTeamId` | 字串（UUID） | no | 所有已連結的 Apple 團隊 | 團隊的其中一個 Apple 團隊，來自 [appstore_list_apple_teams](https://air.build/tw/docs/mcp-tools/appstore_list_apple_teams/)。搭配 `appId` 時，只會在這個 Apple 團隊中尋找該 App。搭配 `projectId` 時不需要：由專案的 App 決定。 |
| `platform` | 字串：`IOS`、`MAC_OS`、`TV_OS`、`VISION_OS` | no | `IOS` | 哪個平台的 App Store 版本。 |
| `versionString` | string | 建立版本時必填 | — | 版本號碼，例如 `1.2.0`。 |
| `buildId` | string | no | — | 附加這個建置版本，來自 [appstore_list_builds](https://air.build/tw/docs/mcp-tools/appstore_list_builds/)。 |
| `buildNumber` | string | no | — | 附加使用這個建置號碼的最新未過期建置版本，例如 `42`。 |
| `useLatestBuild` | boolean | no | — | 附加該版本號碼的最新未過期建置版本。 |
| `release` | 字串：`manual`、`afterApproval`、`scheduled` | no | — | 版本核准後的發布方式。`scheduled` 需要 `scheduledDate`。 |
| `scheduledDate` | 字串（ISO 8601 日期時間） | 搭配 `scheduled` 時必填 | — | 最早發布時間，例如 `2026-11-01T09:00:00Z`。 |
| `phasedRelease` | boolean | no | — | true 會在 7 天內把更新逐步推送給開啟自動更新的使用者；false 會關閉此功能。 |
| `copyright` | string | no | — | 例如 `2026 Example Inc.` |
| `reviewContact` | 物件：`firstName`、`lastName`、`phone`、`email`（字串） | no | — | App 審查的聯絡人。只有傳送的欄位會變更。 |
| `demoAccount` | 物件 `name`、`password`（皆為必填），或 null | no | — | App 審查可以使用的登入資訊；App 不需要登入時為 null。 |
| `reviewNotes` | 字串，最多 4,000 個字元 | no | — | 給 App 審查的備註。 |

每個工具對輸入進行的檢查，請參閱 [伺服器與登入](https://air.build/tw/docs/mcp-tools/server/#errors)。

## 結果

一個 JSON 物件，同時以文字和 `structuredContent` 傳回。

| 欄位 | 說明 |
| --- | --- |
| `version` | 變更之後的版本（欄位見下文） |
| `review` | App 審查取得的內容；沒有設定任何內容時為 null：`contact`（`firstName`、`lastName`、`phone`、`email`）、`demoAccount`（`name`，`password` 只顯示為 `"(set)"`；不需要示範帳號時為 null）以及 `notes` |

版本的欄位：

| 欄位 | 說明 |
| --- | --- |
| `versionId` | Apple 為該版本指定的 ID |
| `version` | 版本號碼，例如 `1.2.0` |
| `state` | Apple 標示的版本狀態，例如 `PREPARE_FOR_SUBMISSION`、`WAITING_FOR_REVIEW`、`IN_REVIEW`、`PENDING_DEVELOPER_RELEASE`、`READY_FOR_SALE`、`REJECTED` |
| `releaseType` | `MANUAL`、`AFTER_APPROVAL` 或 `SCHEDULED`，或 null |
| `scheduledRelease` | 排定發布的最早發布日期，或 null |
| `copyright` | 版權資訊，或 null |
| `build` | 附加的建置版本，`buildId` 和 `buildNumber`，或 null |
| `phasedRelease` | 分階段發布，`state`（`INACTIVE`、`ACTIVE`、`PAUSED`、`COMPLETE`）和 `day`（7 天中的第幾天），或 null |
| `createdAt` | 版本的建立時間 |

```json
{
  "version": {
    "versionId": "00000000-0000-0000-0000-000000000000",
    "version": "1.2.0",
    "state": "PREPARE_FOR_SUBMISSION",
    "releaseType": "AFTER_APPROVAL",
    "scheduledRelease": null,
    "copyright": "2026 Example Inc.",
    "build": {
      "buildId": "00000000-0000-0000-0000-000000000000",
      "buildNumber": "42"
    },
    "phasedRelease": null,
    "createdAt": "2026-11-18T09:00:00Z"
  },
  "review": {
    "contact": {
      "firstName": "Alex",
      "lastName": "Doe",
      "phone": "+1 555 0100",
      "email": "review@example.com"
    },
    "demoAccount": null,
    "notes": "Notes"
  }
}
```

## 錯誤

每個錯誤都會以工具錯誤（`isError: true`）傳回。_斜體_ 文字代表句中的實際值。所有工具都可能傳回的錯誤，請參閱 [伺服器與登入](https://air.build/tw/docs/mcp-tools/server/#errors)。

| 訊息 | 何時出現 | 處理方式 |
| --- | --- | --- |
| No version is being prepared: pass versionString to start one, e.g. 1.2.0. | 沒有可以變更的版本，且沒有傳送 `versionString` | 傳送 `versionString` |
| App Store Connect did not create the version. | Apple 的回應中沒有新版本 | 用 appstore_app_status 查看狀態，然後重試 |
| release must be manual, afterApproval or scheduled. | `release` 是其他值 | 傳送這三個值之一 |
| scheduledDate is required. | `release: "scheduled"` 但沒有 `scheduledDate` | 傳送 `scheduledDate` |
| Build _number_ is _state_: only a processed build can be attached. | 建置版本仍在處理中，或處理失敗 | 等待處理完成（appstore_list_builds），或選擇另一個建置版本 |
| No build _number_ of version _version_ on App Store Connect. See appstore_list_builds. | 此版本中沒有建置版本使用該 `buildNumber` | 用 [appstore_list_builds](https://air.build/tw/docs/mcp-tools/appstore_list_builds/) 查看 |
| No build of version _version_ has reached App Store Connect yet. ask in the Project's channel (send_message) for a TestFlight build. | 使用了 `useLatestBuild`，但該版本號碼沒有任何建置版本 | 用 [send_message](https://air.build/tw/docs/mcp-tools/send_message/) 請專案的 Agent 建置一個版本 |
| No such build. | `buildId` 沒有對應的建置版本 | 從 [appstore_list_builds](https://air.build/tw/docs/mcp-tools/appstore_list_builds/) 取得 `buildId` |
| No build _number_ on App Store Connect. See appstore_list_builds. | 沒有未過期的建置版本使用該 `buildNumber` | 用 [appstore_list_builds](https://air.build/tw/docs/mcp-tools/appstore_list_builds/) 查看 |
| No build of this app has reached App Store Connect yet. Uploading one is the Team's Agents' work: ask in the Project's channel (send_message) for a TestFlight build. | App 完全沒有未過期的建置版本 | 用 [send_message](https://air.build/tw/docs/mcp-tools/send_message/) 請專案的 Agent 建置 TestFlight 版本 |
| Pass projectId, or appId from appstore_list_apps. | `projectId` 和 `appId` 都沒有傳送 | 傳送其中一個 |
| This Project has not been built for iOS yet, so it has no bundle id to find its app by. Ask the Team's Agent to build it, or pass appId. | 該專案從未建置過 iOS 版本 | 請專案的 Agent 建置 iOS 版本（[send_message](https://air.build/tw/docs/mcp-tools/send_message/)），或用 `appId` 指定 App |
| This Project has no app on App Store Connect yet. Create one with appstore_create_app (its bundle id is the Project's), or pass appId. | 團隊已連結的 Apple 團隊中，沒有 App 的 bundle ID 與專案相同，或沒有連結任何 Apple 團隊 | 用 [appstore_create_app](https://air.build/tw/docs/mcp-tools/appstore_create_app/) 建立 App，或用 `appId` 指定另一個 App |
| No connected Apple team of this Team has that app. See appstore_list_apps. | `appId` 不是任何已連結 Apple 團隊（或 `appleTeamId`）中的 App | 從 [appstore_list_apps](https://air.build/tw/docs/mcp-tools/appstore_list_apps/) 取得 ID |
| platform must be IOS, MAC_OS, TV_OS or VISION_OS. | `platform` 是其他值 | 傳送這四個值之一 |
| App Store Connect: _Apple's sentence_ | Apple 拒絕了請求。後面最多附上 Apple 自己的五句說明，Apple 指出相關欄位時會在括號中註明。App Store Connect 中有待接受的 Apple 協議時，也會以這種方式被拒絕 | 依照 Apple 的說明處理。協議由 Apple Developer 帳號的帳號持有人在 App Store Connect 中接受（商務 › 協議） |
| App Store Connect answered _status_. Try again in a moment. | Apple 拒絕了，但沒有說明原因 | 稍後再試 |

## 範例

```json
{
  "name": "appstore_prepare_version",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "versionString": "1.2.0",
    "useLatestBuild": true,
    "release": "afterApproval",
    "reviewContact": {
      "firstName": "Alex",
      "lastName": "Doe",
      "phone": "+1 555 0100",
      "email": "review@example.com"
    },
    "demoAccount": null
  }
}
```
