# simulator_logs

> 這個 MCP 工具會讀取團隊模擬器的裝置記錄：最後幾行，或接下來幾秒內寫入的內容。

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

`simulator_logs` 會讀取團隊正在執行的模擬器的統一記錄。它是唯讀的。預設傳回最後 `lines` 行。使用 `followSeconds` 時，則改為收集裝置從現在起在這麼多秒內寫入的內容。例如，先開始追蹤，然後從另一個呼叫或用戶端讓你的 App 執行要測試的操作。記錄涵蓋整台裝置，而不是某一個 App：請在各行中尋找你的 App 的處理程序名稱。它不會依 App 或層級篩選。

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

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字串（UUID） | 是 | — | 團隊，來自 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/) |
| `simulator` | string | 否 | 團隊的預設裝置 | 哪種裝置，使用 [list_simulators](https://air.build/tw/docs/mcp-tools/list_simulators/#result) 中的 `id` |
| `lines` | 整數，1 到 2000 | 否 | `120` | 要傳回最新的多少行。使用 `followSeconds` 時會忽略 |
| `followSeconds` | 整數，0 到 120 | 否 | — | 改為在這麼多秒內收集新行；`0` 等同於省略 |

## 結果

最後幾行：

| 欄位 | 說明 |
| --- | --- |
| `ok` | `true` |
| `lines` | 記錄行，最早的在前 |

使用 `followSeconds` 時：

| 欄位 | 說明 |
| --- | --- |
| `lines` | 追蹤期間寫入的行，最早的在前 |
| `seconds` | 追蹤了多久 |
| `truncated` | 僅在內容更多時出現：`Only the last 256 KB are kept.` |

```json
{ "ok": true, "lines": [ "2026-11-20 10:00:00.000 Notes[4321:…] Saved note" ] }
```

## 錯誤

| 訊息 | 何時出現 | 處理方式 |
| --- | --- | --- |
| lines must be a whole number of at least 0. | `lines` 不是整數 | 傳送 1 到 2000 |
| followSeconds must be a whole number of at least 0. | `followSeconds` 不是整數 | 傳送 1 到 120 |
| followSeconds is at most 120. | `followSeconds` 大於 120 | 最多傳送 120，需要更多時再次呼叫 |

另外還有每個模擬器工具都可能傳回的錯誤：請參閱 [start_simulator](https://air.build/tw/docs/mcp-tools/start_simulator/#device-errors)。

## 範例

```json
{"name": "simulator_logs", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "followSeconds": 20}}
```
