# simulator_input

> ほかの入力ツールでは扱えないジェスチャのために、チームのシミュレータに生の入力イベントを 1 つ送る MCP ツールです。

Source: https://air.build/ja/docs/mcp-tools/simulator_input/

`simulator_input` は、チームの動作中のシミュレータに生の入力イベントを 1 つ送ります。ほかのツールではできないこと、つまり複数の呼び出しにまたがって押し続けるタッチ、2 本指のピンチ、画面の端からのスワイプに使います。1 つのジェスチャは複数のイベント（押す、1 回以上の移動、離す）からなるので、順番に送るか、[simulator_batch](https://air.build/ja/docs/mcp-tools/simulator_batch/) の `input` ステップとしてまとめて送ってください。位置は [画面座標](https://air.build/ja/docs/mcp-tools/simulator_screen/#coordinates) を使い、要素との照合は行いません。日常的なタップ、スワイプ、入力、ボタンには、それぞれ専用のツールを使ってください。

| 読み取り専用 | 破壊的 | 冪等 |
| --- | --- | --- |
| いいえ | いいえ | いいえ |

## イベント

`event` は、`type` とその種類のフィールドを持つオブジェクトです：

| `type` | フィールド | 内容 |
| --- | --- | --- |
| `touch1-down`, `touch1-move`, `touch1-up`, `touch1-cancel` | `x`、`y`、`edge`（省略可） | 1 本指：置く、動かす、離す、またはキャンセル。`edge`（例：`left`、`bottom`）を指定すると、画面のその端からのスワイプになります |
| `touch2-down`, `touch2-move`, `touch2-up`, `touch2-cancel` | `x1`, `y1`, `x2`, `y2` | 2 本の指を同時に。ピンチや 2 本指の回転に使います |
| `tap` | `x`、`y`、`duration`（省略可） | タップ。座標を指定した [simulator_tap](https://air.build/ja/docs/mcp-tools/simulator_tap/) と同じです |
| `swipe` | `startX`、`startY`、`endX`、`endY`、`duration`（省略可） | [simulator_swipe](https://air.build/ja/docs/mcp-tools/simulator_swipe/) と同じ |
| `type` | `text` | [simulator_type_text](https://air.build/ja/docs/mcp-tools/simulator_type_text/) と同じ |
| `key` | `code`、`modifiers`、`duration`（省略可） | [simulator_key](https://air.build/ja/docs/mcp-tools/simulator_key/) と同じ |
| `button` | `button`、`duration`（省略可） | [simulator_button](https://air.build/ja/docs/mcp-tools/simulator_button/) と同じ |
| `orientation` | `orientation` | [simulator_rotate](https://air.build/ja/docs/mcp-tools/simulator_rotate/) と同じ |
| `fold` | `degrees`（0〜180） | 折りたたみデバイスのヒンジを動かします。[simulator_fold](https://air.build/ja/docs/mcp-tools/simulator_fold/) と同じです |

すべてのポインタイベント（`touch1-*`、`touch2-*`、`tap`、`swipe`）は、省略可能な `width` と `height` も受け付けます。これらを送ると、デバイスの画面ではなくそのサイズのフレームでの座標として扱われ、合うように拡大縮小されます。どのイベントにも、[simulator_displays](https://air.build/ja/docs/mcp-tools/simulator_displays/) のディスプレイの `screenId` である `display` を付けて、折りたたみデバイスの 1 つのディスプレイを指定できます。

## 入力

| 入力 | 型 | 必須 | デフォルト | 内容 |
| --- | --- | --- | --- | --- |
| `teamId` | 文字列（UUID） | はい | — | チーム。[list_teams](https://air.build/ja/docs/mcp-tools/list_teams/) から取得 |
| `simulator` | string | いいえ | チームのデフォルトのデバイス | どのデバイスか。[list_simulators](https://air.build/ja/docs/mcp-tools/list_simulators/#result) の `id` で指定します |
| `event` | `type` を持つオブジェクト | はい | — | [イベント](https://air.build/ja/docs/mcp-tools/simulator_input/#events) |

## 結果

| フィールド | 内容 |
| --- | --- |
| `ok` | `true` |

```json
{ "ok": true }
```

## エラー

| メッセージ | 発生する状況 | 対処 |
| --- | --- | --- |
| event is an object with a "type". | `event` がない、オブジェクトではない、または `type` がない | `type` を持つオブジェクトを送ってください |
| Failed to deserialize the JSON body into the target type: _…_ | 不明な `type`、フィールドの不足、または型の違うフィールド | メッセージで示されたフィールドを修正してください |

このほか、すべてのシミュレータツールが返す可能性のあるエラーがあります。[start_simulator](https://air.build/ja/docs/mcp-tools/start_simulator/#device-errors) を参照してください。

## 例

左端からのスワイプ（戻る）を 3 回の呼び出しで行う例：

```json
{"name": "simulator_input", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "event": {"type": "touch1-down", "x": 2, "y": 400, "edge": "left"}}}
```

```json
{"name": "simulator_input", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "event": {"type": "touch1-move", "x": 200, "y": 400, "edge": "left"}}}
```

```json
{"name": "simulator_input", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "event": {"type": "touch1-up", "x": 300, "y": 400, "edge": "left"}}}
```
