# appstore_update_privacy

> 把 App 的 App 隱私權回答設定為與指定聲明完全相同：預覽變更、儲存變更，或儲存並發佈。

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

把 App 的 App 隱私權回答設定為與傳送的聲明完全相同：聲明中的內容會被新增或更新，Apple 保存的回答中聲明未包含的會被刪除。`mode` 決定要執行到哪一步：

- `preview`（預設）顯示將會產生的變更，不傳送任何內容；
- `apply` 儲存回答；
- `applyAndPublish` 儲存回答並在 App Store 上發佈。

聲明會刪除回答時，除非 `allowDeletes` 為 true，否則 `apply` 和 `applyAndPublish` 會拒絕執行；`preview` 會顯示哪些回答將被刪除。變更依先刪除、再更新、最後新增的順序進行，遇到第一次拒絕就會停止；在此之前的變更會保留。

這個工具透過團隊擁有者在 AirBuild 中的 Apple 登入運作（請參閱 [連結你的 Apple 開發者帳號](https://air.build/tw/docs/app-store/connect-apple-developer-account/)）。團隊的任何成員都可以呼叫；當擁有者的登入已失效且只有擁有者能續期時，呼叫會以下方的句子失敗，直到擁有者重新登入為止。

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

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `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 決定。 |
| `dataUsages` | 物件陣列 | yes | — | 所有資料用途（下方各列）。不收集任何資料的 App：`[{"dataProtections": ["DATA_NOT_COLLECTED"]}]`。搭配 `includeCatalog` 的 [appstore_privacy](https://air.build/tw/docs/mcp-tools/appstore_privacy/) 會列出所有代碼值。 |
| `dataUsages[].category` | string | 收集資料時必填 | — | 資料種類，例如 `EMAIL_ADDRESS`、`PRECISE_LOCATION`。使用 `DATA_NOT_COLLECTED` 時省略。 |
| `dataUsages[].purposes` | 字串陣列 | 使用連結或不連結的保護方式時必填 | — | 例如 `APP_FUNCTIONALITY`、`ANALYTICS`。僅用於追蹤時不需要；使用 `DATA_NOT_COLLECTED` 時省略。 |
| `dataUsages[].dataProtections` | 字串陣列，至少 1 個 | yes | — | `DATA_LINKED_TO_YOU`、`DATA_NOT_LINKED_TO_YOU`、`DATA_USED_TO_TRACK_YOU`；或單獨的 `DATA_NOT_COLLECTED`，作為唯一的一項。 |
| `mode` | 字串：`preview`、`apply`、`applyAndPublish` | no | `preview` | 要執行到哪一步（見上文）。 |
| `allowDeletes` | boolean | no | false | 允許 `apply` 和 `applyAndPublish` 刪除聲明中未包含的回答。 |

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

## 結果

一個 JSON 物件，同時以文字和 `structuredContent` 傳回。每項變更寫作「_類別_ / _用途_ / _保護方式_」，沒有類別時用 `—`。使用 `preview` 時：

| 欄位 | 說明 |
| --- | --- |
| `mode` | `preview` |
| `adds` | 將被新增的回答 |
| `updates` | 將被變更的回答 |
| `deletes` | 將被刪除的回答 |
| `note` | 僅在有刪除時出現：「Applying removes the deletes only with allowDeletes: true.」 |

使用 `apply` 或 `applyAndPublish` 時：

| 欄位 | 說明 |
| --- | --- |
| `mode` | 模式 |
| `changed` | 已完成的操作，每項為「`create`、`update` 或 `delete`：_變更_」 |
| `keptBecauseDeletesNotAllowed` | 因 Apple 沒有提供刪除方式而保留的回答 |
| `published` | 僅搭配 `applyAndPublish`：回答現在是否已發佈 |

```json
{
  "mode": "applyAndPublish",
  "changed": [
    "create: EMAIL_ADDRESS / APP_FUNCTIONALITY / DATA_LINKED_TO_YOU"
  ],
  "keptBecauseDeletesNotAllowed": [],
  "published": true
}
```

## 錯誤

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

| 訊息 | 何時出現 | 處理方式 |
| --- | --- | --- |
| This declaration removes _n_ existing data usage declaration(s). Confirm deletion to proceed. | `apply` 或 `applyAndPublish` 會刪除回答，而 `allowDeletes` 不為 true；沒有做任何變更 | 先預覽，與對方確認，然後傳送 `allowDeletes: true` |
| dataUsages must be a list. | `dataUsages` 不是陣列 | 傳送陣列 |
| declaration.dataUsages must contain at least one entry. | `dataUsages` 為空 | 至少傳送一項；不收集時用 `DATA_NOT_COLLECTED` |
| dataUsages[_i_].category must match [A-Z0-9_]+. | 某個類別不是有效的代碼值 | 使用目錄中的代碼值 |
| dataUsages[_i_].purposes contains the invalid value "_value_". | 某個用途不是有效的代碼值 | 使用目錄中的代碼值 |
| dataUsages[_i_].dataProtections is required. | 某一項沒有保護方式 | 加入保護方式 |
| dataUsages[_i_].dataProtections contains the unsupported value "_value_". | 使用了這四種以外的保護方式 | 使用這四種之一 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot be combined with collected data usages. | `DATA_NOT_COLLECTED` 與其他項目同時出現 | 單獨傳送它 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include other dataProtections. | `DATA_NOT_COLLECTED` 與其他保護方式同時出現 | 單獨傳送它 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include category. | `DATA_NOT_COLLECTED` 帶有類別 | 省略類別 |
| dataUsages[_i_] with DATA_NOT_COLLECTED cannot include purposes. | `DATA_NOT_COLLECTED` 帶有用途 | 省略用途 |
| dataUsages[_i_] with collected data cannot be combined with DATA_NOT_COLLECTED. | 收集資料的項目出現在 `DATA_NOT_COLLECTED` 項目之前 | 刪除其中一個 |
| dataUsages[_i_].category is required when data is collected. | 收集資料的項目沒有類別 | 加入類別 |
| dataUsages[_i_].purposes is required when data is collected. | 連結或不連結的項目沒有用途 | 加入用途 |
| The Team owner's Apple sign-in has lapsed and only they can renew it: ask them to open AirBuild and sign in to Apple again, then try once more. | 團隊擁有者在 AirBuild 中的 Apple 登入已過期，沒有擁有者參與 AirBuild 無法續期 | 告知團隊擁有者，請對方在 AirBuild 中重新登入（請參閱 [連結你的 Apple 開發者帳號](https://air.build/tw/docs/app-store/connect-apple-developer-account/)）。在此之前重試會得到同樣的回應 |
| Another Apple account operation is already in progress. | 同一個 Apple 帳號上正在進行另一項 App Store 操作 | 稍後再試；擁有者不需要重新登入 |
| Apple has locked this Apple Account for security reasons. Unlock it at account.apple.com by signing in with the Apple ID and password, then sign in again. | Apple 鎖定了團隊擁有者的 Apple 帳號 | 只有團隊擁有者能在 account.apple.com 解除鎖定，然後在 AirBuild 中重新登入 |
| 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 |
| 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_update_privacy",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "dataUsages": [
      {
        "category": "EMAIL_ADDRESS",
        "purposes": [
          "APP_FUNCTIONALITY"
        ],
        "dataProtections": [
          "DATA_LINKED_TO_YOU"
        ]
      }
    ],
    "mode": "preview"
  }
}
```
