simulator_drag
這個 MCP 工具會在團隊模擬器的螢幕上用一根手指沿直線拖移,並在放開時不產生甩動。
simulator_drag 會在團隊正在執行的模擬器上按下一根手指,在 duration 秒內沿直線分 steps 次均勻移動,停留片刻後抬起,因此不會產生甩動。用它來重新排列清單、拉動面板或移動自訂控制項。它只接受 螢幕座標,而且兩端都必須在螢幕內。若要快速滑動,請使用 simulator_swipe。它會以只有一步的 simulator_batch 執行,所以它的結果是那種形式。
| 唯讀 | 破壞性 | 冪等 |
|---|---|---|
| 否 | 否 | 否 |
輸入
| 輸入 | 類型 | 必填 | 預設值 | 作用 |
|---|---|---|---|---|
teamId |
字串(UUID) | 是 | — | 團隊,來自 list_teams |
simulator |
string | 否 | 團隊的預設裝置 | 哪種裝置,使用 list_simulators 中的 id |
startX |
數字,-1000000 到 1000000 | 是 | — | 手指落下的位置,橫向 |
startY |
數字,-1000000 到 1000000 | 是 | — | 手指落下的位置,縱向 |
endX |
數字,-1000000 到 1000000 | 是 | — | 停止的位置,橫向 |
endY |
數字,-1000000 到 1000000 | 是 | — | 停止的位置,縱向 |
duration |
數字,0.05 到 60 | 否 | 0.6 |
移動所需的秒數 |
steps |
整數,2 到 1000 | 否 | 30 |
把直線分成多少次移動 |
結果
| 欄位 | 說明 |
|---|---|
ok |
拖移完成時為 true,失敗時為 false |
results |
一項,對應這次拖移 |
failedStep |
失敗時為 0 |
{ "ok": true, "results": [ { "ok": true } ] }錯誤
| 訊息 | 何時出現 | 處理方式 |
|---|---|---|
| startX is required. | 缺少某個座標(startY、endX、endY 同理) |
四個都傳送 |
| duration must be a number from 0.05 to 60. | duration 超出範圍 |
傳送 0.05 到 60 |
| drag endpoints are off-screen | 某一端在螢幕外 | 使用 螢幕 內的點 |
| drag requires finite coordinates, duration 0.05..=60 seconds and steps 2..=1000 | steps 小於 2 或大於 1000 |
傳送 2 到 1000 |
另外還有每個模擬器工具都可能傳回的錯誤:請參閱 start_simulator。
範例
{"name": "simulator_drag", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "startX": 360, "startY": 300, "endX": 360, "endY": 520, "duration": 1}}