# simulator_logs

> 这个 MCP 工具读取团队模拟器的设备日志：最后几行，或接下来几秒内写入的内容。

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

`simulator_logs` 读取团队正在运行的模拟器的统一日志。它是只读的。默认返回最后 `lines` 行。使用 `followSeconds` 时，则改为收集设备从现在起在这么多秒内写入的内容。例如，先开始跟踪，然后从另一个调用或客户端让你的 App 执行要测试的操作。日志涵盖整台设备，而不是某一个 App：请在各行中查找你的 App 的进程名。它不按 App 或级别过滤。

| 只读 | 破坏性 | 幂等 |
| --- | --- | --- |
| 是 | 否 | 是 |

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | 是 | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) |
| `simulator` | string | 否 | 团队的默认设备 | 哪种设备，使用 [list_simulators](https://air.build/cn/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/cn/docs/mcp-tools/start_simulator/#device-errors)。

## 示例

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