mobile-debug-mcp 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/.agents/skills/mcp-builder/SKILL.md +44 -64
  2. package/.agents/skills/mcp-builder/references/build-flags.md +44 -43
  3. package/.agents/skills/mcp-builder/references/diagnostics-schema.md +4 -1
  4. package/.agents/skills/mcp-builder/references/toolchain-details.md +49 -62
  5. package/.agents/skills/spec-review/references/spec-review-checklist.md +7 -0
  6. package/.agents/skills/test-authoring/SKILL.md +7 -6
  7. package/.agents/skills/test-authoring/references/repo-test-layout.md +3 -1
  8. package/.agents/skills/test-authoring/references/test-authoring-workflow.md +16 -7
  9. package/.agents/skills/test-authoring/references/test-quality-checklist.md +2 -1
  10. package/.github/copilot-instructions.md +14 -36
  11. package/.github/workflows/ci.yml +23 -2
  12. package/AGENTS.md +12 -3
  13. package/CONTRIBUTING.md +79 -0
  14. package/README.md +158 -124
  15. package/agent-plugin/.claude-plugin/plugin.json +2 -2
  16. package/agent-plugin/.codex-plugin/plugin.json +1 -1
  17. package/agent-plugin/.cursor-plugin/plugin.json +2 -2
  18. package/agent-plugin/.mcp.json +1 -1
  19. package/agent-plugin/README.md +20 -6
  20. package/agent-plugin/mcp.json +1 -1
  21. package/agent-plugin/plugin.json +1 -1
  22. package/agent-plugin/skills/mobile-debug-mcp/SKILL.md +113 -4
  23. package/dist/contracts/execution-controls.js +24 -0
  24. package/dist/contracts/selector.js +8 -0
  25. package/dist/contracts/target.js +15 -0
  26. package/dist/contracts/ui.js +1 -0
  27. package/dist/debugger/android.js +79 -0
  28. package/dist/debugger/diagnostics.js +54 -0
  29. package/dist/debugger/guard.js +30 -0
  30. package/dist/debugger/protocol.js +33 -0
  31. package/dist/debugger/sessions.js +304 -0
  32. package/dist/debugger/worker.js +176 -0
  33. package/dist/interact/adjustment/adjustment-context.js +41 -0
  34. package/dist/interact/adjustment/adjustment-gestures.js +55 -0
  35. package/dist/interact/adjustment/adjustment-plan.js +18 -0
  36. package/dist/interact/adjustment/adjustment-resolution.js +127 -0
  37. package/dist/interact/adjustment/adjustment-result.js +19 -0
  38. package/dist/interact/adjustment/adjustment-semantic.js +64 -0
  39. package/dist/interact/adjustment/adjustment-verification.js +35 -0
  40. package/dist/interact/adjustment/adjustment.js +52 -0
  41. package/dist/interact/adjustment/control-geometry.js +87 -0
  42. package/dist/interact/adjustment/control-values.js +136 -0
  43. package/dist/interact/adjustment/slider-labels.js +84 -0
  44. package/dist/interact/assertions/screen-assertion.js +37 -0
  45. package/dist/interact/assertions/state-assertion-context.js +35 -0
  46. package/dist/interact/assertions/state-assertion.js +76 -0
  47. package/dist/interact/assertions/state-comparison.js +141 -0
  48. package/dist/interact/assertions/visibility-assertion.js +34 -0
  49. package/dist/interact/conditional-action.js +12 -7
  50. package/dist/interact/index.js +65 -3074
  51. package/dist/interact/input-service.js +1 -0
  52. package/dist/interact/interaction-trace.js +21 -0
  53. package/dist/interact/model.js +1 -0
  54. package/dist/interact/observation.js +1 -0
  55. package/dist/interact/targeting/candidate-ancestor.js +58 -0
  56. package/dist/interact/targeting/candidate-result.js +23 -0
  57. package/dist/interact/targeting/candidate-scoring.js +50 -0
  58. package/dist/interact/targeting/element-helpers.js +216 -0
  59. package/dist/interact/targeting/find-element.js +65 -0
  60. package/dist/interact/targeting/nearby-control.js +56 -0
  61. package/dist/interact/targeting/resolved-elements.js +21 -0
  62. package/dist/interact/targeting/tap-target.js +17 -0
  63. package/dist/interact/targeting/target-scope.js +104 -0
  64. package/dist/interact/waits/legacy-log-wait.js +38 -0
  65. package/dist/interact/waits/legacy-wait-observations.js +103 -0
  66. package/dist/interact/waits/legacy-wait-state.js +34 -0
  67. package/dist/interact/waits/legacy-wait.js +48 -0
  68. package/dist/interact/waits/screen-wait.js +49 -0
  69. package/dist/interact/waits/ui-change-helpers.js +157 -0
  70. package/dist/interact/waits/ui-change-state.js +18 -0
  71. package/dist/interact/waits/ui-change-wait.js +77 -0
  72. package/dist/interact/waits/ui-wait-condition.js +56 -0
  73. package/dist/interact/waits/ui-wait-state.js +38 -0
  74. package/dist/interact/waits/ui-wait.js +106 -0
  75. package/dist/manage/android.js +55 -51
  76. package/dist/manage/index.js +38 -75
  77. package/dist/manage/ios/build-types.js +1 -0
  78. package/dist/manage/ios/build.js +210 -0
  79. package/dist/manage/ios/project-discovery.js +29 -0
  80. package/dist/manage/ios/scheme.js +18 -0
  81. package/dist/manage/ios.js +42 -256
  82. package/dist/observe/android/context.js +1 -0
  83. package/dist/observe/android/current-screen.js +55 -0
  84. package/dist/observe/android/fingerprint.js +13 -0
  85. package/dist/observe/android/log-stream.js +132 -0
  86. package/dist/observe/android/logs.js +107 -0
  87. package/dist/observe/android/screenshot.js +70 -0
  88. package/dist/observe/android/ui-tree.js +107 -0
  89. package/dist/observe/android.js +16 -520
  90. package/dist/observe/evidence.js +122 -76
  91. package/dist/observe/index.js +16 -263
  92. package/dist/observe/ios/context.js +16 -0
  93. package/dist/observe/ios/fingerprint.js +12 -0
  94. package/dist/observe/ios/log-stream.js +105 -0
  95. package/dist/observe/ios/logs.js +168 -0
  96. package/dist/observe/ios/screenshot.js +22 -0
  97. package/dist/observe/ios/ui-elements.js +241 -0
  98. package/dist/observe/ios/ui-tree.js +137 -0
  99. package/dist/observe/ios.js +17 -715
  100. package/dist/observe/logs/model.js +1 -0
  101. package/dist/{network → observe/network}/index.js +2 -2
  102. package/dist/observe/readiness-service.js +13 -2
  103. package/dist/observe/readiness.js +44 -18
  104. package/dist/observe/screenshot-encoding.js +41 -0
  105. package/dist/observe/snapshot-collection.js +79 -0
  106. package/dist/observe/snapshot-logs.js +30 -0
  107. package/dist/observe/snapshot-metadata.js +43 -31
  108. package/dist/observe/snapshot-semantic.js +115 -0
  109. package/dist/observe/system-trace-android.js +135 -0
  110. package/dist/observe/system-trace.js +294 -0
  111. package/dist/runtime/action-results.js +270 -0
  112. package/dist/runtime/clock.js +4 -0
  113. package/dist/server/common.js +1 -256
  114. package/dist/server/definitions/assert.js +162 -0
  115. package/dist/server/definitions/diagnostic.js +118 -0
  116. package/dist/server/definitions/input.js +274 -0
  117. package/dist/server/definitions/manage.js +194 -0
  118. package/dist/server/definitions/observe.js +149 -0
  119. package/dist/server/definitions/target.js +138 -0
  120. package/dist/server/definitions/wait.js +105 -0
  121. package/dist/server/handlers/action-execution.js +163 -0
  122. package/dist/server/handlers/correlation.js +23 -0
  123. package/dist/server/handlers/debugger-handlers.js +48 -0
  124. package/dist/server/handlers/debugger-response.js +9 -0
  125. package/dist/server/handlers/diagnostic.js +69 -0
  126. package/dist/server/handlers/handler-types.js +1 -0
  127. package/dist/server/handlers/input.js +154 -0
  128. package/dist/server/handlers/interact.js +113 -0
  129. package/dist/server/handlers/journey-assertions.js +35 -0
  130. package/dist/server/handlers/journey.js +147 -0
  131. package/dist/server/handlers/manage.js +119 -0
  132. package/dist/server/handlers/observe.js +95 -0
  133. package/dist/server/handlers/payload.js +4 -0
  134. package/dist/server/handlers/tool-handlers.js +160 -0
  135. package/dist/server/schemas/condition-schema.js +2 -0
  136. package/dist/server/schemas/debugger-schema.js +47 -0
  137. package/dist/server/{journey-schema.js → schemas/journey-schema.js} +8 -22
  138. package/dist/server/schemas/system-trace-schema.js +17 -0
  139. package/dist/server/tool-definitions.js +62 -1134
  140. package/dist/server-core.js +4 -4
  141. package/dist/server.js +34 -0
  142. package/dist/system/android-status.js +101 -0
  143. package/dist/system/android.js +37 -27
  144. package/dist/system/index.js +13 -438
  145. package/dist/system/ios-status.js +132 -0
  146. package/dist/system/ios.js +11 -8
  147. package/dist/system/model.js +1 -0
  148. package/dist/system/probes.js +105 -0
  149. package/dist/system/status-summary.js +43 -0
  150. package/dist/system/unsupported-status.js +52 -0
  151. package/dist/utils/android/commands.js +89 -0
  152. package/dist/utils/android/gradle.js +139 -0
  153. package/dist/utils/android/logs.js +103 -0
  154. package/dist/utils/android/ui-tree.js +233 -0
  155. package/dist/utils/android/utils.js +6 -564
  156. package/dist/utils/cli/idb/idb-helper.js +4 -6
  157. package/dist/utils/cli/idb/install-idb.js +13 -9
  158. package/dist/utils/cli/ios/preflight-ios.js +42 -38
  159. package/dist/utils/exec.js +2 -0
  160. package/dist/utils/ios/utils.js +45 -46
  161. package/dist/utils/java.js +75 -57
  162. package/dist/utils/operation-budget.js +2 -0
  163. package/dist/utils/resolve-device.js +6 -2
  164. package/dist/utils/ui/index.js +26 -26
  165. package/docs/CHANGELOG.md +48 -0
  166. package/docs/README.md +38 -0
  167. package/docs/benchmarks/README.md +18 -0
  168. package/docs/benchmarks/interaction-latency/README.md +14 -0
  169. package/docs/benchmarks/interaction-latency/final.md +4 -1
  170. package/docs/benchmarks/interaction-latency/ios-validation.md +2 -0
  171. package/docs/benchmarks/ui-tree-performance/README.md +24 -16
  172. package/docs/benchmarks/ui-tree-performance/comparison.md +11 -10
  173. package/docs/code-structure.md +118 -0
  174. package/docs/specs/001-state-verification/spec.md +16 -14
  175. package/docs/specs/002-richer-element-identity/spec.md +12 -10
  176. package/docs/specs/003-wait-and-synchronization-reliability/spec.md +12 -10
  177. package/docs/specs/004-action-verification-routing/spec.md +3 -3
  178. package/docs/specs/005-unified-action-execution-and-verification-model/spec.md +2 -0
  179. package/docs/specs/006-runtime-action-instrumentation-and-binding-layer/spec.md +2 -0
  180. package/docs/specs/007-actionability-resolution-and-executable-target-selection/spec.md +3 -1
  181. package/docs/specs/008-adjustable-control-support-and-semantic-value-manipulation/spec.md +3 -4
  182. package/docs/specs/009-semantic-control-modeling-for-custom-and-composite-controls/spec.md +2 -0
  183. package/docs/specs/010-verification-stabilization-and-temporal-convergence/spec.md +2 -2
  184. package/docs/specs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows/spec.md +2 -2
  185. package/docs/specs/011.1-recovery-contract-types-and-runtime-wiring-spec/spec.md +2 -0
  186. package/docs/specs/012-action-trace-and-xecution-observability/spec.md +2 -3
  187. package/docs/specs/013-wait-and-synchronization-reliability/spec.md +19 -19
  188. package/docs/specs/014-actionability-resolution/spec.md +20 -18
  189. package/docs/specs/015-adjustable-control-support/spec.md +17 -15
  190. package/docs/specs/016-environment-tools/spec.md +20 -20
  191. package/docs/specs/018-interaction-latency-and-batched-journeys/spec.md +2 -0
  192. package/docs/specs/019-ui-tree-observation-performance/spec.md +3 -1
  193. package/docs/specs/020-conditional-actions/intent.md +5 -3
  194. package/docs/specs/020-conditional-actions/plan.md +8 -9
  195. package/docs/specs/020-conditional-actions/spec.md +4 -2
  196. package/docs/specs/021-app-readiness-signals/intent.md +4 -2
  197. package/docs/specs/021-app-readiness-signals/plan.md +7 -6
  198. package/docs/specs/021-app-readiness-signals/spec.md +3 -1
  199. package/docs/specs/022-correlated-evidence/intent.md +4 -4
  200. package/docs/specs/022-correlated-evidence/plan.md +10 -11
  201. package/docs/specs/022-correlated-evidence/spec.md +3 -1
  202. package/docs/specs/023-android-system-traces/device-evidence.json +38 -0
  203. package/docs/specs/023-android-system-traces/emulator-recheck.json +38 -0
  204. package/docs/specs/023-android-system-traces/intent.md +41 -0
  205. package/docs/specs/023-android-system-traces/plan.md +115 -0
  206. package/docs/specs/023-android-system-traces/spec.md +122 -0
  207. package/docs/specs/024-android-heap-dump-capture/intent.md +41 -0
  208. package/docs/specs/025-android-runtime-debugger/intent.md +41 -0
  209. package/docs/specs/025-android-runtime-debugger/plan.md +106 -0
  210. package/docs/specs/025-android-runtime-debugger/spec.md +183 -0
  211. package/docs/specs/026-code-structure-and-quality-gates/health-plan.md +88 -0
  212. package/docs/specs/026-code-structure-and-quality-gates/intent.md +47 -0
  213. package/docs/specs/026-code-structure-and-quality-gates/plan.md +191 -0
  214. package/docs/specs/026-code-structure-and-quality-gates/spec.md +138 -0
  215. package/docs/specs/026-code-structure-and-quality-gates/verification-final.json +200 -0
  216. package/docs/specs/026-code-structure-and-quality-gates/verification-thin-facade.json +154 -0
  217. package/docs/specs/026-code-structure-and-quality-gates/verification.json +136 -0
  218. package/docs/specs/027-debugger-failure-diagnostics/intent.md +43 -0
  219. package/docs/specs/027-debugger-failure-diagnostics/plan.md +86 -0
  220. package/docs/specs/027-debugger-failure-diagnostics/spec.md +133 -0
  221. package/docs/specs/028-compact-debugger-responses/intent.md +41 -0
  222. package/docs/specs/028-compact-debugger-responses/plan.md +112 -0
  223. package/docs/specs/028-compact-debugger-responses/spec.md +108 -0
  224. package/docs/specs/029-kotlin-locals-validation/report.md +119 -0
  225. package/docs/specs/030-android-coroutine-validation/evidence.json +475 -0
  226. package/docs/specs/030-android-coroutine-validation/intent.md +47 -0
  227. package/docs/specs/030-android-coroutine-validation/plan.md +147 -0
  228. package/docs/specs/030-android-coroutine-validation/report.md +240 -0
  229. package/docs/specs/030-android-coroutine-validation/spec.md +107 -0
  230. package/docs/tools/TOOLS.md +31 -16
  231. package/docs/tools/{evidence.md → correlated-evidence.md} +14 -3
  232. package/docs/tools/debugger.md +180 -0
  233. package/docs/tools/interact.md +42 -20
  234. package/docs/tools/manage.md +25 -44
  235. package/docs/tools/observe.md +64 -25
  236. package/docs/tools/system-traces.md +134 -0
  237. package/docs/tools/system.md +12 -5
  238. package/package.json +11 -8
  239. package/scripts/architecture-graph.mjs +69 -0
  240. package/scripts/check-architecture.mjs +47 -0
  241. package/scripts/code-quality-baseline.json +1 -0
  242. package/scripts/code-quality.mjs +161 -0
  243. package/src/contracts/execution-controls.ts +26 -0
  244. package/src/contracts/selector.ts +17 -0
  245. package/src/contracts/target.ts +19 -0
  246. package/src/contracts/ui.ts +94 -0
  247. package/src/debugger/android.ts +66 -0
  248. package/src/debugger/diagnostics.ts +43 -0
  249. package/src/debugger/guard.ts +31 -0
  250. package/src/debugger/java/DebuggerWorker.java +166 -0
  251. package/src/debugger/protocol.ts +37 -0
  252. package/src/debugger/sessions.ts +327 -0
  253. package/src/debugger/worker.ts +135 -0
  254. package/src/interact/adjustment/adjustment-context.ts +83 -0
  255. package/src/interact/adjustment/adjustment-gestures.ts +48 -0
  256. package/src/interact/adjustment/adjustment-plan.ts +23 -0
  257. package/src/interact/adjustment/adjustment-resolution.ts +104 -0
  258. package/src/interact/adjustment/adjustment-result.ts +34 -0
  259. package/src/interact/adjustment/adjustment-semantic.ts +53 -0
  260. package/src/interact/adjustment/adjustment-verification.ts +60 -0
  261. package/src/interact/adjustment/adjustment.ts +49 -0
  262. package/src/interact/adjustment/control-geometry.ts +120 -0
  263. package/src/interact/adjustment/control-values.ts +141 -0
  264. package/src/interact/adjustment/slider-labels.ts +84 -0
  265. package/src/interact/assertions/screen-assertion.ts +39 -0
  266. package/src/interact/assertions/state-assertion-context.ts +48 -0
  267. package/src/interact/assertions/state-assertion.ts +64 -0
  268. package/src/interact/assertions/state-comparison.ts +168 -0
  269. package/src/interact/assertions/visibility-assertion.ts +41 -0
  270. package/src/interact/conditional-action.ts +18 -12
  271. package/src/interact/index.ts +76 -3491
  272. package/src/interact/input-service.ts +11 -0
  273. package/src/interact/interaction-trace.ts +36 -0
  274. package/src/interact/model.ts +109 -0
  275. package/src/interact/observation.ts +7 -0
  276. package/src/interact/targeting/candidate-ancestor.ts +49 -0
  277. package/src/interact/targeting/candidate-result.ts +24 -0
  278. package/src/interact/targeting/candidate-scoring.ts +42 -0
  279. package/src/interact/targeting/element-helpers.ts +243 -0
  280. package/src/interact/targeting/find-element.ts +47 -0
  281. package/src/interact/targeting/nearby-control.ts +46 -0
  282. package/src/interact/targeting/resolved-elements.ts +20 -0
  283. package/src/interact/targeting/tap-target.ts +22 -0
  284. package/src/interact/targeting/target-scope.ts +121 -0
  285. package/src/interact/waits/legacy-log-wait.ts +30 -0
  286. package/src/interact/waits/legacy-wait-observations.ts +55 -0
  287. package/src/interact/waits/legacy-wait-state.ts +48 -0
  288. package/src/interact/waits/legacy-wait.ts +34 -0
  289. package/src/interact/waits/screen-wait.ts +37 -0
  290. package/src/interact/waits/ui-change-helpers.ts +184 -0
  291. package/src/interact/waits/ui-change-state.ts +26 -0
  292. package/src/interact/waits/ui-change-wait.ts +59 -0
  293. package/src/interact/waits/ui-wait-condition.ts +52 -0
  294. package/src/interact/waits/ui-wait-state.ts +55 -0
  295. package/src/interact/waits/ui-wait.ts +84 -0
  296. package/src/manage/android.ts +56 -50
  297. package/src/manage/index.ts +63 -93
  298. package/src/manage/ios/build-types.ts +14 -0
  299. package/src/manage/ios/build.ts +230 -0
  300. package/src/manage/ios/project-discovery.ts +26 -0
  301. package/src/manage/ios/scheme.ts +16 -0
  302. package/src/manage/ios.ts +65 -298
  303. package/src/observe/android/context.ts +1 -0
  304. package/src/observe/android/current-screen.ts +63 -0
  305. package/src/observe/android/fingerprint.ts +13 -0
  306. package/src/observe/android/log-stream.ts +127 -0
  307. package/src/observe/android/logs.ts +110 -0
  308. package/src/observe/android/screenshot.ts +79 -0
  309. package/src/observe/android/ui-tree.ts +113 -0
  310. package/src/observe/android.ts +17 -531
  311. package/src/observe/evidence.ts +130 -71
  312. package/src/observe/index.ts +24 -286
  313. package/src/observe/ios/context.ts +22 -0
  314. package/src/observe/ios/fingerprint.ts +12 -0
  315. package/src/observe/ios/log-stream.ts +103 -0
  316. package/src/observe/ios/logs.ts +179 -0
  317. package/src/observe/ios/screenshot.ts +26 -0
  318. package/src/observe/ios/ui-elements.ts +266 -0
  319. package/src/observe/ios/ui-tree.ts +143 -0
  320. package/src/observe/ios.ts +18 -749
  321. package/src/observe/logs/model.ts +11 -0
  322. package/src/{network → observe/network}/index.ts +2 -2
  323. package/src/observe/readiness-service.ts +10 -3
  324. package/src/observe/readiness.ts +49 -22
  325. package/src/observe/screenshot-encoding.ts +32 -0
  326. package/src/observe/snapshot-collection.ts +69 -0
  327. package/src/observe/snapshot-logs.ts +26 -0
  328. package/src/observe/snapshot-metadata.ts +51 -31
  329. package/src/observe/snapshot-semantic.ts +153 -0
  330. package/src/observe/system-trace-android.ts +133 -0
  331. package/src/observe/system-trace.ts +227 -0
  332. package/src/runtime/action-results.ts +376 -0
  333. package/src/runtime/clock.ts +9 -0
  334. package/src/server/common.ts +9 -359
  335. package/src/server/definitions/assert.ts +164 -0
  336. package/src/server/definitions/diagnostic.ts +120 -0
  337. package/src/server/definitions/input.ts +276 -0
  338. package/src/server/definitions/manage.ts +196 -0
  339. package/src/server/definitions/observe.ts +151 -0
  340. package/src/server/definitions/target.ts +140 -0
  341. package/src/server/definitions/wait.ts +107 -0
  342. package/src/server/handlers/action-execution.ts +164 -0
  343. package/src/server/handlers/correlation.ts +20 -0
  344. package/src/server/handlers/debugger-handlers.ts +39 -0
  345. package/src/server/handlers/debugger-response.ts +7 -0
  346. package/src/server/handlers/diagnostic.ts +79 -0
  347. package/src/server/handlers/handler-types.ts +7 -0
  348. package/src/server/handlers/input.ts +173 -0
  349. package/src/server/handlers/interact.ts +135 -0
  350. package/src/server/handlers/journey-assertions.ts +39 -0
  351. package/src/server/handlers/journey.ts +132 -0
  352. package/src/server/handlers/manage.ts +141 -0
  353. package/src/server/handlers/observe.ts +116 -0
  354. package/src/server/handlers/payload.ts +36 -0
  355. package/src/server/handlers/tool-handlers.ts +159 -0
  356. package/src/server/schemas/condition-schema.ts +2 -0
  357. package/src/server/schemas/debugger-schema.ts +43 -0
  358. package/src/server/{journey-schema.ts → schemas/journey-schema.ts} +8 -22
  359. package/src/server/schemas/system-trace-schema.ts +17 -0
  360. package/src/server/tool-definitions.ts +69 -1140
  361. package/src/server-core.ts +4 -4
  362. package/src/server.ts +25 -1
  363. package/src/system/android-status.ts +124 -0
  364. package/src/system/android.ts +33 -21
  365. package/src/system/index.ts +21 -523
  366. package/src/system/ios-status.ts +147 -0
  367. package/src/system/ios.ts +14 -10
  368. package/src/system/model.ts +41 -0
  369. package/src/system/probes.ts +114 -0
  370. package/src/system/status-summary.ts +47 -0
  371. package/src/system/unsupported-status.ts +55 -0
  372. package/src/types.ts +16 -106
  373. package/src/utils/android/commands.ts +81 -0
  374. package/src/utils/android/gradle.ts +132 -0
  375. package/src/utils/android/logs.ts +103 -0
  376. package/src/utils/android/ui-tree.ts +239 -0
  377. package/src/utils/android/utils.ts +16 -556
  378. package/src/utils/cli/idb/check-idb.ts +4 -4
  379. package/src/utils/cli/idb/idb-helper.ts +6 -8
  380. package/src/utils/cli/idb/install-idb.ts +15 -9
  381. package/src/utils/cli/ios/preflight-ios.ts +39 -31
  382. package/src/utils/cli/ios/run-ios-ui-tree-tap.ts +4 -4
  383. package/src/utils/exec.ts +2 -0
  384. package/src/utils/ios/utils.ts +57 -61
  385. package/src/utils/java.ts +71 -51
  386. package/src/utils/operation-budget.ts +2 -0
  387. package/src/utils/resolve-device.ts +11 -6
  388. package/src/utils/ui/index.ts +28 -28
  389. package/test/device/automated/debugger/coroutine-lifecycle.ts +27 -0
  390. package/test/device/automated/debugger/coroutine-support.ts +140 -0
  391. package/test/device/automated/debugger/coroutine.android.test.ts +169 -0
  392. package/test/device/automated/debugger/kotlin.android.test.ts +127 -0
  393. package/test/device/automated/debugger/runtime.android.test.ts +219 -0
  394. package/test/device/automated/interact/interaction.android.test.ts +56 -0
  395. package/test/device/automated/observe/system-trace.smoke.ts +104 -0
  396. package/test/device/manual/interact/modul8_selector_tap.manual.ts +1 -1
  397. package/test/fixtures/contracts/tool-definitions.json +3536 -0
  398. package/test/fixtures/coroutine-app/MainActivity.kt +100 -0
  399. package/test/fixtures/coroutine-app/README.md +48 -0
  400. package/test/fixtures/coroutine-app/build.ts +35 -0
  401. package/test/fixtures/debugger-app/MainActivity.java +67 -0
  402. package/test/fixtures/debugger-app/MainActivity.kt +32 -0
  403. package/test/fixtures/debugger-app/NoLocals.java +7 -0
  404. package/test/fixtures/debugger-app/README.md +65 -0
  405. package/test/fixtures/debugger-app/build.ts +39 -0
  406. package/test/fixtures/latency-journey-app/README.md +2 -0
  407. package/test/fixtures/readiness-app/README.md +2 -0
  408. package/test/helpers/perfetto.ts +59 -0
  409. package/test/unit/debugger/coroutine-lifecycle.test.ts +43 -0
  410. package/test/unit/debugger/diagnostic-sessions.test.ts +67 -0
  411. package/test/unit/debugger/diagnostics.test.ts +80 -0
  412. package/test/unit/debugger/guards.test.ts +50 -0
  413. package/test/unit/debugger/native.test.ts +33 -0
  414. package/test/unit/debugger/preparation.test.ts +32 -0
  415. package/test/unit/debugger/protocol.test.ts +15 -0
  416. package/test/unit/debugger/sessions.test.ts +83 -0
  417. package/test/unit/interact/adjustment_service.test.ts +42 -0
  418. package/test/unit/interact/adjustment_verification.test.ts +35 -0
  419. package/test/unit/interact/clock_dependencies.test.ts +63 -0
  420. package/test/unit/interact/element_helpers.test.ts +19 -0
  421. package/test/unit/interact/legacy_wait_service.test.ts +17 -0
  422. package/test/unit/interact/state_comparison.test.ts +20 -0
  423. package/test/unit/interact/target_scope.test.ts +35 -0
  424. package/test/unit/network/get_network_activity.test.ts +1 -1
  425. package/test/unit/observe/readiness.test.ts +3 -1
  426. package/test/unit/observe/screenshot-encoding.test.ts +30 -0
  427. package/test/unit/observe/snapshot-logs.test.ts +14 -0
  428. package/test/unit/observe/system-trace-android.test.ts +52 -0
  429. package/test/unit/observe/system-trace.test.ts +166 -0
  430. package/test/unit/quality/architecture.test.ts +60 -0
  431. package/test/unit/quality/code-quality.test.ts +58 -0
  432. package/test/unit/quality/interaction_boundaries.test.ts +24 -0
  433. package/test/unit/server/conditional_actions.test.ts +1 -1
  434. package/test/unit/server/conditional_schema.test.ts +2 -2
  435. package/test/unit/server/debugger-response.test.ts +63 -0
  436. package/test/unit/server/system-trace.test.ts +64 -0
  437. package/test/unit/server/tool_definitions_parity.test.ts +8 -0
  438. package/dist/server/tool-handlers.js +0 -893
  439. package/docs/ROADMAP.md +0 -646
  440. package/docs/benchmarks/ui-tree-performance/bridge-probe.json +0 -29
  441. package/docs/benchmarks/ui-tree-performance/initial-baseline.json +0 -59560
  442. package/docs/specs/baseline-spec-v0.md +0 -312
  443. package/docs/specs/mcp-tooling-spec-v1.md +0 -446
  444. package/src/server/tool-handlers.ts +0 -923
  445. /package/dist/{server/condition-schema.js → contracts/condition.js} +0 -0
  446. /package/dist/server/{readiness-schema.js → schemas/readiness-schema.js} +0 -0
  447. /package/src/{server/condition-schema.ts → contracts/condition.ts} +0 -0
  448. /package/src/server/{readiness-schema.ts → schemas/readiness-schema.ts} +0 -0
@@ -0,0 +1,3536 @@
1
+ [
2
+ {
3
+ "name": "get_debugger_capabilities",
4
+ "description": "Probe optional Android JDK/JDWP prerequisites and matching running debuggable processes; does not attach.",
5
+ "inputSchema": {
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "platform",
10
+ "deviceId",
11
+ "appId"
12
+ ],
13
+ "properties": {
14
+ "responseMode": {
15
+ "type": "string",
16
+ "enum": [
17
+ "compact",
18
+ "debug"
19
+ ],
20
+ "default": "debug"
21
+ },
22
+ "platform": {
23
+ "type": "string",
24
+ "enum": [
25
+ "android"
26
+ ]
27
+ },
28
+ "deviceId": {
29
+ "type": "string",
30
+ "minLength": 1,
31
+ "maxLength": 512
32
+ },
33
+ "appId": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "maxLength": 512,
37
+ "pattern": "^[A-Za-z][\\w]*(?:\\.[A-Za-z][\\w]*)+$"
38
+ },
39
+ "processId": {
40
+ "type": "integer",
41
+ "minimum": 0,
42
+ "maximum": 9007199254740991
43
+ },
44
+ "timeoutMs": {
45
+ "type": "integer",
46
+ "minimum": 100,
47
+ "maximum": 30000,
48
+ "default": 10000
49
+ }
50
+ },
51
+ "allOf": [
52
+ {
53
+ "not": {
54
+ "required": [
55
+ "expectedState"
56
+ ]
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ {
63
+ "name": "attach_debugger",
64
+ "description": "Attach an owned Android JDI session. Requires an explicit device and debuggable app; choose processId when ambiguous. Stops suspend all app threads. Auto-detach: 60s paused, 5m idle, 30m total.",
65
+ "inputSchema": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "required": [
69
+ "platform",
70
+ "deviceId",
71
+ "appId"
72
+ ],
73
+ "properties": {
74
+ "responseMode": {
75
+ "type": "string",
76
+ "enum": [
77
+ "compact",
78
+ "debug"
79
+ ],
80
+ "default": "debug"
81
+ },
82
+ "platform": {
83
+ "type": "string",
84
+ "enum": [
85
+ "android"
86
+ ]
87
+ },
88
+ "deviceId": {
89
+ "type": "string",
90
+ "minLength": 1,
91
+ "maxLength": 512
92
+ },
93
+ "appId": {
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "maxLength": 512,
97
+ "pattern": "^[A-Za-z][\\w]*(?:\\.[A-Za-z][\\w]*)+$"
98
+ },
99
+ "processId": {
100
+ "type": "integer",
101
+ "minimum": 0,
102
+ "maximum": 9007199254740991
103
+ },
104
+ "timeoutMs": {
105
+ "type": "integer",
106
+ "minimum": 100,
107
+ "maximum": 30000,
108
+ "default": 10000
109
+ }
110
+ },
111
+ "allOf": [
112
+ {
113
+ "not": {
114
+ "required": [
115
+ "expectedState"
116
+ ]
117
+ }
118
+ }
119
+ ]
120
+ }
121
+ },
122
+ {
123
+ "name": "get_debugger_state",
124
+ "description": "Read debugger state, current stop and breakpoint/cleanup status.",
125
+ "inputSchema": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "required": [
129
+ "debugSessionId"
130
+ ],
131
+ "properties": {
132
+ "responseMode": {
133
+ "type": "string",
134
+ "enum": [
135
+ "compact",
136
+ "debug"
137
+ ],
138
+ "default": "debug"
139
+ },
140
+ "debugSessionId": {
141
+ "type": "string",
142
+ "minLength": 1,
143
+ "maxLength": 512
144
+ },
145
+ "timeoutMs": {
146
+ "type": "integer",
147
+ "minimum": 100,
148
+ "maximum": 30000,
149
+ "default": 10000
150
+ }
151
+ },
152
+ "allOf": [
153
+ {
154
+ "not": {
155
+ "required": [
156
+ "expectedState"
157
+ ]
158
+ }
159
+ }
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "name": "set_debugger_breakpoint",
165
+ "description": "Set an exact binary-class and executable-source-line breakpoint; unloaded classes remain pending. No silent line relocation.",
166
+ "inputSchema": {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "required": [
170
+ "debugSessionId",
171
+ "className",
172
+ "line"
173
+ ],
174
+ "properties": {
175
+ "responseMode": {
176
+ "type": "string",
177
+ "enum": [
178
+ "compact",
179
+ "debug"
180
+ ],
181
+ "default": "debug"
182
+ },
183
+ "debugSessionId": {
184
+ "type": "string",
185
+ "minLength": 1,
186
+ "maxLength": 512
187
+ },
188
+ "className": {
189
+ "type": "string",
190
+ "minLength": 1,
191
+ "maxLength": 512,
192
+ "pattern": "^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$"
193
+ },
194
+ "line": {
195
+ "type": "integer",
196
+ "minimum": 0,
197
+ "maximum": 9007199254740991
198
+ },
199
+ "timeoutMs": {
200
+ "type": "integer",
201
+ "minimum": 100,
202
+ "maximum": 30000,
203
+ "default": 10000
204
+ }
205
+ },
206
+ "allOf": [
207
+ {
208
+ "not": {
209
+ "required": [
210
+ "expectedState"
211
+ ]
212
+ }
213
+ }
214
+ ]
215
+ }
216
+ },
217
+ {
218
+ "name": "remove_debugger_breakpoint",
219
+ "description": "Remove an owned breakpoint; repeated removal succeeds.",
220
+ "inputSchema": {
221
+ "type": "object",
222
+ "additionalProperties": false,
223
+ "required": [
224
+ "debugSessionId",
225
+ "breakpointId"
226
+ ],
227
+ "properties": {
228
+ "responseMode": {
229
+ "type": "string",
230
+ "enum": [
231
+ "compact",
232
+ "debug"
233
+ ],
234
+ "default": "debug"
235
+ },
236
+ "debugSessionId": {
237
+ "type": "string",
238
+ "minLength": 1,
239
+ "maxLength": 512
240
+ },
241
+ "breakpointId": {
242
+ "type": "string",
243
+ "minLength": 1,
244
+ "maxLength": 512
245
+ },
246
+ "timeoutMs": {
247
+ "type": "integer",
248
+ "minimum": 100,
249
+ "maximum": 30000,
250
+ "default": 10000
251
+ }
252
+ },
253
+ "allOf": [
254
+ {
255
+ "not": {
256
+ "required": [
257
+ "expectedState"
258
+ ]
259
+ }
260
+ }
261
+ ]
262
+ }
263
+ },
264
+ {
265
+ "name": "wait_for_debugger_event",
266
+ "description": "Wait for bounded debugger events after a sequence cursor. Empty timeout does not affect execution; overflow is explicit.",
267
+ "inputSchema": {
268
+ "type": "object",
269
+ "additionalProperties": false,
270
+ "required": [
271
+ "debugSessionId"
272
+ ],
273
+ "properties": {
274
+ "responseMode": {
275
+ "type": "string",
276
+ "enum": [
277
+ "compact",
278
+ "debug"
279
+ ],
280
+ "default": "debug"
281
+ },
282
+ "debugSessionId": {
283
+ "type": "string",
284
+ "minLength": 1,
285
+ "maxLength": 512
286
+ },
287
+ "afterSequence": {
288
+ "type": "integer",
289
+ "minimum": 0,
290
+ "maximum": 9007199254740991
291
+ },
292
+ "timeoutMs": {
293
+ "type": "integer",
294
+ "minimum": 100,
295
+ "maximum": 30000,
296
+ "default": 1000
297
+ }
298
+ },
299
+ "allOf": [
300
+ {
301
+ "not": {
302
+ "required": [
303
+ "expectedState"
304
+ ]
305
+ }
306
+ }
307
+ ]
308
+ }
309
+ },
310
+ {
311
+ "name": "get_debugger_stack",
312
+ "description": "Read bounded stack frames for a stopped thread; IDs expire on resume.",
313
+ "inputSchema": {
314
+ "type": "object",
315
+ "additionalProperties": false,
316
+ "required": [
317
+ "debugSessionId",
318
+ "stopId",
319
+ "threadId"
320
+ ],
321
+ "properties": {
322
+ "responseMode": {
323
+ "type": "string",
324
+ "enum": [
325
+ "compact",
326
+ "debug"
327
+ ],
328
+ "default": "debug"
329
+ },
330
+ "debugSessionId": {
331
+ "type": "string",
332
+ "minLength": 1,
333
+ "maxLength": 512
334
+ },
335
+ "stopId": {
336
+ "type": "string",
337
+ "minLength": 1,
338
+ "maxLength": 512
339
+ },
340
+ "threadId": {
341
+ "type": "string",
342
+ "minLength": 1,
343
+ "maxLength": 512
344
+ },
345
+ "offset": {
346
+ "type": "integer",
347
+ "minimum": 0,
348
+ "maximum": 999
349
+ },
350
+ "limit": {
351
+ "type": "integer",
352
+ "minimum": 1,
353
+ "maximum": 100
354
+ },
355
+ "timeoutMs": {
356
+ "type": "integer",
357
+ "minimum": 100,
358
+ "maximum": 30000,
359
+ "default": 10000
360
+ }
361
+ },
362
+ "allOf": [
363
+ {
364
+ "not": {
365
+ "required": [
366
+ "expectedState"
367
+ ]
368
+ }
369
+ }
370
+ ]
371
+ }
372
+ },
373
+ {
374
+ "name": "get_debugger_locals",
375
+ "description": "Read at most 100 shallow locals. Sensitive values returned only on request; strings truncate at 256 characters. No evaluation or field traversal.",
376
+ "inputSchema": {
377
+ "type": "object",
378
+ "additionalProperties": false,
379
+ "required": [
380
+ "debugSessionId",
381
+ "stopId",
382
+ "frameId"
383
+ ],
384
+ "properties": {
385
+ "responseMode": {
386
+ "type": "string",
387
+ "enum": [
388
+ "compact",
389
+ "debug"
390
+ ],
391
+ "default": "debug"
392
+ },
393
+ "debugSessionId": {
394
+ "type": "string",
395
+ "minLength": 1,
396
+ "maxLength": 512
397
+ },
398
+ "stopId": {
399
+ "type": "string",
400
+ "minLength": 1,
401
+ "maxLength": 512
402
+ },
403
+ "frameId": {
404
+ "type": "string",
405
+ "minLength": 1,
406
+ "maxLength": 512
407
+ },
408
+ "timeoutMs": {
409
+ "type": "integer",
410
+ "minimum": 100,
411
+ "maximum": 30000,
412
+ "default": 10000
413
+ }
414
+ },
415
+ "allOf": [
416
+ {
417
+ "not": {
418
+ "required": [
419
+ "expectedState"
420
+ ]
421
+ }
422
+ }
423
+ ]
424
+ }
425
+ },
426
+ {
427
+ "name": "step_debugger",
428
+ "description": "Acknowledge one-shot line stepping and resume. Wait for a subsequent stop event separately.",
429
+ "inputSchema": {
430
+ "type": "object",
431
+ "additionalProperties": false,
432
+ "required": [
433
+ "debugSessionId",
434
+ "stopId",
435
+ "threadId",
436
+ "kind"
437
+ ],
438
+ "properties": {
439
+ "responseMode": {
440
+ "type": "string",
441
+ "enum": [
442
+ "compact",
443
+ "debug"
444
+ ],
445
+ "default": "debug"
446
+ },
447
+ "debugSessionId": {
448
+ "type": "string",
449
+ "minLength": 1,
450
+ "maxLength": 512
451
+ },
452
+ "stopId": {
453
+ "type": "string",
454
+ "minLength": 1,
455
+ "maxLength": 512
456
+ },
457
+ "threadId": {
458
+ "type": "string",
459
+ "minLength": 1,
460
+ "maxLength": 512
461
+ },
462
+ "kind": {
463
+ "type": "string",
464
+ "enum": [
465
+ "into",
466
+ "over",
467
+ "out"
468
+ ]
469
+ },
470
+ "timeoutMs": {
471
+ "type": "integer",
472
+ "minimum": 100,
473
+ "maximum": 30000,
474
+ "default": 10000
475
+ }
476
+ },
477
+ "allOf": [
478
+ {
479
+ "not": {
480
+ "required": [
481
+ "expectedState"
482
+ ]
483
+ }
484
+ }
485
+ ]
486
+ }
487
+ },
488
+ {
489
+ "name": "resume_debugger",
490
+ "description": "Resume owned debugger suspension and immediately expire stopped references.",
491
+ "inputSchema": {
492
+ "type": "object",
493
+ "additionalProperties": false,
494
+ "required": [
495
+ "debugSessionId",
496
+ "stopId"
497
+ ],
498
+ "properties": {
499
+ "responseMode": {
500
+ "type": "string",
501
+ "enum": [
502
+ "compact",
503
+ "debug"
504
+ ],
505
+ "default": "debug"
506
+ },
507
+ "debugSessionId": {
508
+ "type": "string",
509
+ "minLength": 1,
510
+ "maxLength": 512
511
+ },
512
+ "stopId": {
513
+ "type": "string",
514
+ "minLength": 1,
515
+ "maxLength": 512
516
+ },
517
+ "timeoutMs": {
518
+ "type": "integer",
519
+ "minimum": 100,
520
+ "maximum": 30000,
521
+ "default": 10000
522
+ }
523
+ },
524
+ "allOf": [
525
+ {
526
+ "not": {
527
+ "required": [
528
+ "expectedState"
529
+ ]
530
+ }
531
+ }
532
+ ]
533
+ }
534
+ },
535
+ {
536
+ "name": "detach_debugger",
537
+ "description": "Dispose the owned debugger connection, release owned suspension and remove its exact forward. Idempotent; retries incomplete cleanup.",
538
+ "inputSchema": {
539
+ "type": "object",
540
+ "additionalProperties": false,
541
+ "required": [
542
+ "debugSessionId"
543
+ ],
544
+ "properties": {
545
+ "responseMode": {
546
+ "type": "string",
547
+ "enum": [
548
+ "compact",
549
+ "debug"
550
+ ],
551
+ "default": "debug"
552
+ },
553
+ "debugSessionId": {
554
+ "type": "string",
555
+ "minLength": 1,
556
+ "maxLength": 512
557
+ },
558
+ "timeoutMs": {
559
+ "type": "integer",
560
+ "minimum": 100,
561
+ "maximum": 30000,
562
+ "default": 10000
563
+ }
564
+ },
565
+ "allOf": [
566
+ {
567
+ "not": {
568
+ "required": [
569
+ "expectedState"
570
+ ]
571
+ }
572
+ }
573
+ ]
574
+ }
575
+ },
576
+ {
577
+ "name": "get_system_trace_capabilities",
578
+ "description": "Probe Android Perfetto prerequisites without recording. Device-wide system tracing is optional; iOS is unsupported.",
579
+ "inputSchema": {
580
+ "type": "object",
581
+ "additionalProperties": false,
582
+ "required": [
583
+ "platform"
584
+ ],
585
+ "properties": {
586
+ "platform": {
587
+ "type": "string",
588
+ "enum": [
589
+ "android",
590
+ "ios"
591
+ ]
592
+ },
593
+ "deviceId": {
594
+ "type": "string",
595
+ "minLength": 1
596
+ }
597
+ },
598
+ "allOf": [
599
+ {
600
+ "not": {
601
+ "required": [
602
+ "expectedState"
603
+ ]
604
+ }
605
+ }
606
+ ]
607
+ }
608
+ },
609
+ {
610
+ "name": "start_system_trace",
611
+ "description": "Start bounded Android Perfetto recording, returning an owned trace_id. Run an existing journey with systemTraceId, then stop to retrieve a local artifact or cancel to discard. Device-wide traces may contain sensitive system annotations; no upload.",
612
+ "inputSchema": {
613
+ "type": "object",
614
+ "additionalProperties": false,
615
+ "required": [
616
+ "platform"
617
+ ],
618
+ "properties": {
619
+ "platform": {
620
+ "type": "string",
621
+ "enum": [
622
+ "android",
623
+ "ios"
624
+ ]
625
+ },
626
+ "deviceId": {
627
+ "type": "string",
628
+ "minLength": 1
629
+ },
630
+ "durationMs": {
631
+ "type": "integer",
632
+ "minimum": 1000,
633
+ "maximum": 120000,
634
+ "default": 30000
635
+ }
636
+ },
637
+ "allOf": [
638
+ {
639
+ "not": {
640
+ "required": [
641
+ "expectedState"
642
+ ]
643
+ }
644
+ }
645
+ ]
646
+ }
647
+ },
648
+ {
649
+ "name": "get_system_trace_status",
650
+ "description": "Reconcile an owned trace and retrieve its state; finalise duration-completed capture.",
651
+ "inputSchema": {
652
+ "type": "object",
653
+ "additionalProperties": false,
654
+ "required": [
655
+ "traceId"
656
+ ],
657
+ "properties": {
658
+ "traceId": {
659
+ "type": "string",
660
+ "format": "uuid"
661
+ }
662
+ },
663
+ "allOf": [
664
+ {
665
+ "not": {
666
+ "required": [
667
+ "expectedState"
668
+ ]
669
+ }
670
+ }
671
+ ]
672
+ }
673
+ },
674
+ {
675
+ "name": "stop_system_trace",
676
+ "description": "Stop owned capture gracefully and retrieve a local Perfetto artifact. Retry after a transfer/cleanup failure.",
677
+ "inputSchema": {
678
+ "type": "object",
679
+ "additionalProperties": false,
680
+ "required": [
681
+ "traceId"
682
+ ],
683
+ "properties": {
684
+ "traceId": {
685
+ "type": "string",
686
+ "format": "uuid"
687
+ }
688
+ },
689
+ "allOf": [
690
+ {
691
+ "not": {
692
+ "required": [
693
+ "expectedState"
694
+ ]
695
+ }
696
+ }
697
+ ]
698
+ }
699
+ },
700
+ {
701
+ "name": "cancel_system_trace",
702
+ "description": "Stop owned capture and discard partial files. Already completed local artifacts are retained.",
703
+ "inputSchema": {
704
+ "type": "object",
705
+ "additionalProperties": false,
706
+ "required": [
707
+ "traceId"
708
+ ],
709
+ "properties": {
710
+ "traceId": {
711
+ "type": "string",
712
+ "format": "uuid"
713
+ }
714
+ },
715
+ "allOf": [
716
+ {
717
+ "not": {
718
+ "required": [
719
+ "expectedState"
720
+ ]
721
+ }
722
+ }
723
+ ]
724
+ }
725
+ },
726
+ {
727
+ "name": "get_app_readiness",
728
+ "description": "Observe readiness with at most two fresh UI-tree samples. Reports loading, transitioning, settled or unknown with evidence and limitations. Managed Android debugger pauses are reported from debugger evidence; unresponsive detection remains unsupported. Settled normalized foreground UI is not proof of app identity, responsiveness or backend completion.",
729
+ "inputSchema": {
730
+ "type": "object",
731
+ "additionalProperties": false,
732
+ "required": [
733
+ "platform"
734
+ ],
735
+ "properties": {
736
+ "platform": {
737
+ "type": "string",
738
+ "enum": [
739
+ "android",
740
+ "ios"
741
+ ]
742
+ },
743
+ "deviceId": {
744
+ "type": "string",
745
+ "minLength": 1
746
+ },
747
+ "timeoutMs": {
748
+ "type": "integer",
749
+ "minimum": 100,
750
+ "maximum": 60000,
751
+ "default": 15000
752
+ },
753
+ "stabilityMs": {
754
+ "type": "integer",
755
+ "minimum": 100,
756
+ "maximum": 10000,
757
+ "default": 500
758
+ }
759
+ },
760
+ "allOf": [
761
+ {
762
+ "not": {
763
+ "required": [
764
+ "expectedState"
765
+ ]
766
+ }
767
+ }
768
+ ]
769
+ }
770
+ },
771
+ {
772
+ "name": "wait_for_app_ready",
773
+ "description": "Wait within a single bounded budget for settled UI evidence. Reports loading, transitioning, settled or unknown with evidence and limitations. Managed Android debugger pauses are reported from debugger evidence; unresponsive detection remains unsupported. Settled normalized foreground UI is not proof of app identity, responsiveness or backend completion.",
774
+ "inputSchema": {
775
+ "type": "object",
776
+ "additionalProperties": false,
777
+ "required": [
778
+ "platform"
779
+ ],
780
+ "properties": {
781
+ "platform": {
782
+ "type": "string",
783
+ "enum": [
784
+ "android",
785
+ "ios"
786
+ ]
787
+ },
788
+ "deviceId": {
789
+ "type": "string",
790
+ "minLength": 1
791
+ },
792
+ "timeoutMs": {
793
+ "type": "integer",
794
+ "minimum": 100,
795
+ "maximum": 60000,
796
+ "default": 30000
797
+ },
798
+ "stabilityMs": {
799
+ "type": "integer",
800
+ "minimum": 100,
801
+ "maximum": 10000,
802
+ "default": 500
803
+ },
804
+ "pollIntervalMs": {
805
+ "type": "integer",
806
+ "minimum": 100,
807
+ "maximum": 1000,
808
+ "default": 500
809
+ }
810
+ },
811
+ "allOf": [
812
+ {
813
+ "not": {
814
+ "required": [
815
+ "expectedState"
816
+ ]
817
+ }
818
+ }
819
+ ]
820
+ }
821
+ },
822
+ {
823
+ "name": "start_app",
824
+ "description": "Purpose:\nLaunch a mobile app on Android or iOS.\n\nInputs:\n- platform\n- appId\n- deviceId (optional)\n\nOutput Structure:\n - action_id, timestamp (ISO 8601), action_type\n - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n - source_module: runtime source of the action envelope\n - target.selector = { appId }\n- success = true when launch was dispatched successfully\n- failure_code/retryable when launch dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Define the expected landing screen when it is known\n2. Call start_app\n3. If needed, wait for transition using wait_for_*\n4. Verify with expect_screen\n5. If verification fails, retry once or capture a snapshot\n\nVerification Guidance:\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- expect_screen is the authoritative verification step when the landing screen is known\n- Do not treat timing or screen change alone as final verification\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → inspect snapshot/logs before retrying",
825
+ "inputSchema": {
826
+ "type": "object",
827
+ "properties": {
828
+ "platform": {
829
+ "type": "string",
830
+ "enum": [
831
+ "android",
832
+ "ios"
833
+ ]
834
+ },
835
+ "appId": {
836
+ "type": "string",
837
+ "description": "Android package name or iOS bundle id"
838
+ },
839
+ "deviceId": {
840
+ "type": "string",
841
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
842
+ },
843
+ "verificationMode": {
844
+ "type": "string",
845
+ "enum": [
846
+ "none",
847
+ "light",
848
+ "full"
849
+ ],
850
+ "default": "full"
851
+ },
852
+ "responseMode": {
853
+ "type": "string",
854
+ "enum": [
855
+ "compact",
856
+ "debug"
857
+ ],
858
+ "default": "debug"
859
+ },
860
+ "actionTimeoutMs": {
861
+ "type": "integer",
862
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
863
+ },
864
+ "verificationTimeoutMs": {
865
+ "type": "integer",
866
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
867
+ }
868
+ },
869
+ "required": [
870
+ "platform",
871
+ "appId"
872
+ ],
873
+ "allOf": [
874
+ {
875
+ "not": {
876
+ "required": [
877
+ "expectedState"
878
+ ]
879
+ }
880
+ }
881
+ ]
882
+ }
883
+ },
884
+ {
885
+ "name": "terminate_app",
886
+ "description": "Terminate a mobile app on Android or iOS simulator",
887
+ "inputSchema": {
888
+ "type": "object",
889
+ "properties": {
890
+ "platform": {
891
+ "type": "string",
892
+ "enum": [
893
+ "android",
894
+ "ios"
895
+ ]
896
+ },
897
+ "appId": {
898
+ "type": "string",
899
+ "description": "Android package name or iOS bundle id"
900
+ },
901
+ "deviceId": {
902
+ "type": "string",
903
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
904
+ }
905
+ },
906
+ "required": [
907
+ "platform",
908
+ "appId"
909
+ ],
910
+ "allOf": [
911
+ {
912
+ "not": {
913
+ "required": [
914
+ "expectedState"
915
+ ]
916
+ }
917
+ }
918
+ ]
919
+ }
920
+ },
921
+ {
922
+ "name": "restart_app",
923
+ "description": "Purpose:\nRestart a mobile app on Android or iOS.\n\nInputs:\n- platform\n- appId\n- deviceId (optional)\n\nOutput Structure:\n - action_id, timestamp (ISO 8601), action_type\n - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n - source_module: runtime source of the action envelope\n - target.selector = { appId }\n- success = true when the restart command completed\n- failure_code/retryable when restart dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Define the expected landing screen when it is known\n2. Call restart_app\n3. If needed, wait for transition using wait_for_*\n4. Verify with expect_screen\n5. If verification fails, retry once or capture a snapshot\n\nVerification Guidance:\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- expect_screen is the authoritative verification step when the reopened screen is known\n- Do not treat timing or screen change alone as final verification\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → inspect snapshot/logs before retrying",
924
+ "inputSchema": {
925
+ "type": "object",
926
+ "properties": {
927
+ "platform": {
928
+ "type": "string",
929
+ "enum": [
930
+ "android",
931
+ "ios"
932
+ ]
933
+ },
934
+ "appId": {
935
+ "type": "string",
936
+ "description": "Android package name or iOS bundle id"
937
+ },
938
+ "deviceId": {
939
+ "type": "string",
940
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
941
+ },
942
+ "verificationMode": {
943
+ "type": "string",
944
+ "enum": [
945
+ "none",
946
+ "light",
947
+ "full"
948
+ ],
949
+ "default": "full"
950
+ },
951
+ "responseMode": {
952
+ "type": "string",
953
+ "enum": [
954
+ "compact",
955
+ "debug"
956
+ ],
957
+ "default": "debug"
958
+ },
959
+ "actionTimeoutMs": {
960
+ "type": "integer",
961
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
962
+ },
963
+ "verificationTimeoutMs": {
964
+ "type": "integer",
965
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
966
+ }
967
+ },
968
+ "required": [
969
+ "platform",
970
+ "appId"
971
+ ],
972
+ "allOf": [
973
+ {
974
+ "not": {
975
+ "required": [
976
+ "expectedState"
977
+ ]
978
+ }
979
+ }
980
+ ]
981
+ }
982
+ },
983
+ {
984
+ "name": "reset_app_data",
985
+ "description": "Reset app data (clear storage) for a mobile app on Android or iOS simulator",
986
+ "inputSchema": {
987
+ "type": "object",
988
+ "properties": {
989
+ "platform": {
990
+ "type": "string",
991
+ "enum": [
992
+ "android",
993
+ "ios"
994
+ ]
995
+ },
996
+ "appId": {
997
+ "type": "string",
998
+ "description": "Android package name or iOS bundle id"
999
+ },
1000
+ "deviceId": {
1001
+ "type": "string",
1002
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
1003
+ }
1004
+ },
1005
+ "required": [
1006
+ "platform",
1007
+ "appId"
1008
+ ],
1009
+ "allOf": [
1010
+ {
1011
+ "not": {
1012
+ "required": [
1013
+ "expectedState"
1014
+ ]
1015
+ }
1016
+ }
1017
+ ]
1018
+ }
1019
+ },
1020
+ {
1021
+ "name": "install_app",
1022
+ "description": "Install an app on Android or iOS. Accepts a built binary (apk/.ipa/.app) or a project directory to build then install. platform and projectType are required.",
1023
+ "inputSchema": {
1024
+ "type": "object",
1025
+ "properties": {
1026
+ "platform": {
1027
+ "type": "string",
1028
+ "enum": [
1029
+ "android",
1030
+ "ios"
1031
+ ],
1032
+ "description": "Platform to install to (required)."
1033
+ },
1034
+ "projectType": {
1035
+ "type": "string",
1036
+ "enum": [
1037
+ "native",
1038
+ "kmp",
1039
+ "react-native",
1040
+ "flutter"
1041
+ ],
1042
+ "description": "Project type to guide build/install tool selection (required)."
1043
+ },
1044
+ "appPath": {
1045
+ "type": "string",
1046
+ "description": "Path to APK, .app, .ipa, or project directory"
1047
+ },
1048
+ "deviceId": {
1049
+ "type": "string",
1050
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
1051
+ }
1052
+ },
1053
+ "required": [
1054
+ "platform",
1055
+ "projectType",
1056
+ "appPath"
1057
+ ],
1058
+ "allOf": [
1059
+ {
1060
+ "not": {
1061
+ "required": [
1062
+ "expectedState"
1063
+ ]
1064
+ }
1065
+ }
1066
+ ]
1067
+ }
1068
+ },
1069
+ {
1070
+ "name": "build_app",
1071
+ "description": "Build a project for Android or iOS and return the built artifact path. Does not install. platform and projectType are required.",
1072
+ "inputSchema": {
1073
+ "type": "object",
1074
+ "properties": {
1075
+ "platform": {
1076
+ "type": "string",
1077
+ "enum": [
1078
+ "android",
1079
+ "ios"
1080
+ ],
1081
+ "description": "Platform to build for (required)."
1082
+ },
1083
+ "projectType": {
1084
+ "type": "string",
1085
+ "enum": [
1086
+ "native",
1087
+ "kmp",
1088
+ "react-native",
1089
+ "flutter"
1090
+ ],
1091
+ "description": "Project type to guide build tool selection (required)."
1092
+ },
1093
+ "projectPath": {
1094
+ "type": "string",
1095
+ "description": "Path to project directory (contains gradlew or xcodeproj/xcworkspace)"
1096
+ },
1097
+ "variant": {
1098
+ "type": "string",
1099
+ "description": "Optional build variant (e.g., Debug/Release)"
1100
+ }
1101
+ },
1102
+ "required": [
1103
+ "platform",
1104
+ "projectType",
1105
+ "projectPath"
1106
+ ],
1107
+ "allOf": [
1108
+ {
1109
+ "not": {
1110
+ "required": [
1111
+ "expectedState"
1112
+ ]
1113
+ }
1114
+ }
1115
+ ]
1116
+ }
1117
+ },
1118
+ {
1119
+ "name": "get_logs",
1120
+ "description": "Get recent logs from Android or iOS simulator. Returns device metadata and structured logs suitable for AI consumption.\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1121
+ "inputSchema": {
1122
+ "type": "object",
1123
+ "properties": {
1124
+ "platform": {
1125
+ "type": "string",
1126
+ "enum": [
1127
+ "android",
1128
+ "ios"
1129
+ ]
1130
+ },
1131
+ "appId": {
1132
+ "type": "string",
1133
+ "description": "Filter by Android package name or iOS bundle id"
1134
+ },
1135
+ "deviceId": {
1136
+ "type": "string",
1137
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
1138
+ },
1139
+ "pid": {
1140
+ "type": "number",
1141
+ "description": "Filter by process id"
1142
+ },
1143
+ "tag": {
1144
+ "type": "string",
1145
+ "description": "Filter by tag (Android) or subsystem/category (iOS)"
1146
+ },
1147
+ "level": {
1148
+ "type": "string",
1149
+ "description": "Log level filter (VERBOSE, DEBUG, INFO, WARN, ERROR)"
1150
+ },
1151
+ "contains": {
1152
+ "type": "string",
1153
+ "description": "Substring to match in log message"
1154
+ },
1155
+ "since_seconds": {
1156
+ "type": "number",
1157
+ "description": "Only return logs from the last N seconds"
1158
+ },
1159
+ "limit": {
1160
+ "type": "number",
1161
+ "description": "Override default number of returned lines"
1162
+ },
1163
+ "lines": {
1164
+ "type": "number",
1165
+ "description": "Legacy - number of log lines (android only)"
1166
+ },
1167
+ "actionRef": {
1168
+ "type": "object",
1169
+ "additionalProperties": false,
1170
+ "required": [
1171
+ "sessionId",
1172
+ "actionId"
1173
+ ],
1174
+ "properties": {
1175
+ "sessionId": {
1176
+ "type": "string",
1177
+ "minLength": 1,
1178
+ "maxLength": 128
1179
+ },
1180
+ "actionId": {
1181
+ "type": "string",
1182
+ "minLength": 1,
1183
+ "maxLength": 128
1184
+ }
1185
+ }
1186
+ }
1187
+ },
1188
+ "required": [
1189
+ "platform"
1190
+ ],
1191
+ "allOf": [
1192
+ {
1193
+ "not": {
1194
+ "required": [
1195
+ "expectedState"
1196
+ ]
1197
+ }
1198
+ }
1199
+ ]
1200
+ }
1201
+ },
1202
+ {
1203
+ "name": "list_devices",
1204
+ "description": "List connected devices and their metadata (android + ios).",
1205
+ "inputSchema": {
1206
+ "type": "object",
1207
+ "properties": {
1208
+ "platform": {
1209
+ "type": "string",
1210
+ "enum": [
1211
+ "android",
1212
+ "ios"
1213
+ ]
1214
+ }
1215
+ },
1216
+ "allOf": [
1217
+ {
1218
+ "not": {
1219
+ "required": [
1220
+ "expectedState"
1221
+ ]
1222
+ }
1223
+ }
1224
+ ]
1225
+ }
1226
+ },
1227
+ {
1228
+ "name": "get_system_status",
1229
+ "description": "Quick healthcheck of local mobile debugging environment (adb, devices, logs, env, iOS).",
1230
+ "inputSchema": {
1231
+ "type": "object",
1232
+ "properties": {},
1233
+ "allOf": [
1234
+ {
1235
+ "not": {
1236
+ "required": [
1237
+ "expectedState"
1238
+ ]
1239
+ }
1240
+ }
1241
+ ]
1242
+ }
1243
+ },
1244
+ {
1245
+ "name": "capture_screenshot",
1246
+ "description": "Capture a screenshot from an Android device or iOS simulator. Returns device metadata and the screenshot image.\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1247
+ "inputSchema": {
1248
+ "type": "object",
1249
+ "properties": {
1250
+ "platform": {
1251
+ "type": "string",
1252
+ "enum": [
1253
+ "android",
1254
+ "ios"
1255
+ ]
1256
+ },
1257
+ "deviceId": {
1258
+ "type": "string",
1259
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
1260
+ },
1261
+ "actionRef": {
1262
+ "type": "object",
1263
+ "additionalProperties": false,
1264
+ "required": [
1265
+ "sessionId",
1266
+ "actionId"
1267
+ ],
1268
+ "properties": {
1269
+ "sessionId": {
1270
+ "type": "string",
1271
+ "minLength": 1,
1272
+ "maxLength": 128
1273
+ },
1274
+ "actionId": {
1275
+ "type": "string",
1276
+ "minLength": 1,
1277
+ "maxLength": 128
1278
+ }
1279
+ }
1280
+ }
1281
+ },
1282
+ "required": [
1283
+ "platform"
1284
+ ],
1285
+ "allOf": [
1286
+ {
1287
+ "not": {
1288
+ "required": [
1289
+ "expectedState"
1290
+ ]
1291
+ }
1292
+ }
1293
+ ]
1294
+ }
1295
+ },
1296
+ {
1297
+ "name": "capture_debug_snapshot",
1298
+ "description": "Capture a complete debug snapshot (raw observation layer plus optional derived semantic layer). Returns structured JSON with snapshot_revision, captured_at_ms, snapshot_delta, and loading_state when detectable.\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1299
+ "inputSchema": {
1300
+ "type": "object",
1301
+ "properties": {
1302
+ "reason": {
1303
+ "type": "string",
1304
+ "description": "Optional reason for snapshot"
1305
+ },
1306
+ "includeLogs": {
1307
+ "type": "boolean",
1308
+ "description": "Whether to include logs",
1309
+ "default": true
1310
+ },
1311
+ "includeScreenshot": {
1312
+ "type": "boolean",
1313
+ "description": "Whether to collect screenshot bytes",
1314
+ "default": true
1315
+ },
1316
+ "logLines": {
1317
+ "type": "number",
1318
+ "description": "Maximum number of log lines to include",
1319
+ "default": 200
1320
+ },
1321
+ "platform": {
1322
+ "type": "string",
1323
+ "enum": [
1324
+ "android",
1325
+ "ios"
1326
+ ],
1327
+ "description": "Optional platform override"
1328
+ },
1329
+ "appId": {
1330
+ "type": "string",
1331
+ "description": "Optional appId to scope logs (package/bundle id)"
1332
+ },
1333
+ "deviceId": {
1334
+ "type": "string",
1335
+ "description": "Optional device serial/udid"
1336
+ },
1337
+ "sessionId": {
1338
+ "type": "string",
1339
+ "description": "Optional log stream session id to prefer"
1340
+ },
1341
+ "actionRef": {
1342
+ "type": "object",
1343
+ "additionalProperties": false,
1344
+ "required": [
1345
+ "sessionId",
1346
+ "actionId"
1347
+ ],
1348
+ "properties": {
1349
+ "sessionId": {
1350
+ "type": "string",
1351
+ "minLength": 1,
1352
+ "maxLength": 128
1353
+ },
1354
+ "actionId": {
1355
+ "type": "string",
1356
+ "minLength": 1,
1357
+ "maxLength": 128
1358
+ }
1359
+ }
1360
+ }
1361
+ },
1362
+ "allOf": [
1363
+ {
1364
+ "not": {
1365
+ "required": [
1366
+ "expectedState"
1367
+ ]
1368
+ }
1369
+ }
1370
+ ]
1371
+ }
1372
+ },
1373
+ {
1374
+ "name": "start_log_stream",
1375
+ "description": "Start streaming logs for a target application on Android or iOS. For Android this uses adb logcat --pid=<pid>; for iOS it streams `xcrun simctl spawn <device> log stream` with a predicate.",
1376
+ "inputSchema": {
1377
+ "type": "object",
1378
+ "properties": {
1379
+ "platform": {
1380
+ "type": "string",
1381
+ "enum": [
1382
+ "android",
1383
+ "ios"
1384
+ ],
1385
+ "default": "android"
1386
+ },
1387
+ "packageName": {
1388
+ "type": "string",
1389
+ "description": "Android package name or iOS bundle id"
1390
+ },
1391
+ "level": {
1392
+ "type": "string",
1393
+ "enum": [
1394
+ "error",
1395
+ "warn",
1396
+ "info",
1397
+ "debug"
1398
+ ],
1399
+ "default": "error"
1400
+ },
1401
+ "deviceId": {
1402
+ "type": "string",
1403
+ "description": "Device Serial (Android) or UDID (iOS). Defaults to connected/booted device."
1404
+ },
1405
+ "sessionId": {
1406
+ "type": "string",
1407
+ "description": "Session identifier for the log stream"
1408
+ }
1409
+ },
1410
+ "required": [
1411
+ "packageName"
1412
+ ],
1413
+ "allOf": [
1414
+ {
1415
+ "not": {
1416
+ "required": [
1417
+ "expectedState"
1418
+ ]
1419
+ }
1420
+ }
1421
+ ]
1422
+ }
1423
+ },
1424
+ {
1425
+ "name": "read_log_stream",
1426
+ "description": "Read accumulated log stream entries for the active session.\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1427
+ "inputSchema": {
1428
+ "type": "object",
1429
+ "properties": {
1430
+ "sessionId": {
1431
+ "type": "string"
1432
+ },
1433
+ "actionRef": {
1434
+ "type": "object",
1435
+ "additionalProperties": false,
1436
+ "required": [
1437
+ "sessionId",
1438
+ "actionId"
1439
+ ],
1440
+ "properties": {
1441
+ "sessionId": {
1442
+ "type": "string",
1443
+ "minLength": 1,
1444
+ "maxLength": 128
1445
+ },
1446
+ "actionId": {
1447
+ "type": "string",
1448
+ "minLength": 1,
1449
+ "maxLength": 128
1450
+ }
1451
+ }
1452
+ }
1453
+ },
1454
+ "allOf": [
1455
+ {
1456
+ "not": {
1457
+ "required": [
1458
+ "expectedState"
1459
+ ]
1460
+ }
1461
+ }
1462
+ ]
1463
+ }
1464
+ },
1465
+ {
1466
+ "name": "stop_log_stream",
1467
+ "description": "Stop an active log stream for the session.",
1468
+ "inputSchema": {
1469
+ "type": "object",
1470
+ "properties": {
1471
+ "sessionId": {
1472
+ "type": "string"
1473
+ }
1474
+ },
1475
+ "allOf": [
1476
+ {
1477
+ "not": {
1478
+ "required": [
1479
+ "expectedState"
1480
+ ]
1481
+ }
1482
+ }
1483
+ ]
1484
+ }
1485
+ },
1486
+ {
1487
+ "name": "get_ui_tree",
1488
+ "description": "Get the current UI hierarchy from an Android device or iOS simulator. Returns a structured JSON representation of the screen content with snapshot metadata and incremental delta signals when available.\nSuccessful observations include snapshot_session_id and snapshot_revision for same-device conditional input. Compact errors preserve the error and cannot authorize an expectation.\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1489
+ "inputSchema": {
1490
+ "type": "object",
1491
+ "properties": {
1492
+ "platform": {
1493
+ "type": "string",
1494
+ "enum": [
1495
+ "android",
1496
+ "ios"
1497
+ ],
1498
+ "description": "Platform to get UI tree for"
1499
+ },
1500
+ "deviceId": {
1501
+ "type": "string",
1502
+ "description": "Device Serial (Android) or UDID (iOS). Defaults to connected/booted device."
1503
+ },
1504
+ "responseMode": {
1505
+ "type": "string",
1506
+ "enum": [
1507
+ "compact",
1508
+ "debug"
1509
+ ],
1510
+ "default": "debug"
1511
+ },
1512
+ "sinceSnapshotRevision": {
1513
+ "type": "number",
1514
+ "minimum": 1
1515
+ },
1516
+ "actionRef": {
1517
+ "type": "object",
1518
+ "additionalProperties": false,
1519
+ "required": [
1520
+ "sessionId",
1521
+ "actionId"
1522
+ ],
1523
+ "properties": {
1524
+ "sessionId": {
1525
+ "type": "string",
1526
+ "minLength": 1,
1527
+ "maxLength": 128
1528
+ },
1529
+ "actionId": {
1530
+ "type": "string",
1531
+ "minLength": 1,
1532
+ "maxLength": 128
1533
+ }
1534
+ }
1535
+ }
1536
+ },
1537
+ "required": [
1538
+ "platform"
1539
+ ],
1540
+ "allOf": [
1541
+ {
1542
+ "not": {
1543
+ "required": [
1544
+ "expectedState"
1545
+ ]
1546
+ }
1547
+ }
1548
+ ]
1549
+ }
1550
+ },
1551
+ {
1552
+ "name": "get_current_screen",
1553
+ "description": "Get the currently visible activity on an Android device. Returns package and activity name.",
1554
+ "inputSchema": {
1555
+ "type": "object",
1556
+ "properties": {
1557
+ "deviceId": {
1558
+ "type": "string",
1559
+ "description": "Device Serial (Android). Defaults to connected/booted device."
1560
+ }
1561
+ },
1562
+ "allOf": [
1563
+ {
1564
+ "not": {
1565
+ "required": [
1566
+ "expectedState"
1567
+ ]
1568
+ }
1569
+ }
1570
+ ]
1571
+ }
1572
+ },
1573
+ {
1574
+ "name": "get_screen_fingerprint",
1575
+ "description": "Generate a stable fingerprint representing the current visible screen (activity + visible UI elements).\nReturns evidence metadata with acquisition intervals and conservative freshness. Optional actionRef links a known same-session/device action; unavailable references collect independently. Device log times are not comparable with host dispatch times.",
1576
+ "inputSchema": {
1577
+ "type": "object",
1578
+ "properties": {
1579
+ "platform": {
1580
+ "type": "string",
1581
+ "enum": [
1582
+ "android",
1583
+ "ios"
1584
+ ],
1585
+ "description": "Optional platform override (android|ios)"
1586
+ },
1587
+ "deviceId": {
1588
+ "type": "string",
1589
+ "description": "Optional device id/udid to target"
1590
+ },
1591
+ "actionRef": {
1592
+ "type": "object",
1593
+ "additionalProperties": false,
1594
+ "required": [
1595
+ "sessionId",
1596
+ "actionId"
1597
+ ],
1598
+ "properties": {
1599
+ "sessionId": {
1600
+ "type": "string",
1601
+ "minLength": 1,
1602
+ "maxLength": 128
1603
+ },
1604
+ "actionId": {
1605
+ "type": "string",
1606
+ "minLength": 1,
1607
+ "maxLength": 128
1608
+ }
1609
+ }
1610
+ }
1611
+ },
1612
+ "allOf": [
1613
+ {
1614
+ "not": {
1615
+ "required": [
1616
+ "expectedState"
1617
+ ]
1618
+ }
1619
+ }
1620
+ ]
1621
+ }
1622
+ },
1623
+ {
1624
+ "name": "wait_for_screen_change",
1625
+ "description": "Purpose:\nDetect that a screen transition has occurred by waiting for the current fingerprint to differ from a previous fingerprint.\n\nCapabilities:\n- Synchronization for uncertain navigation timing\n- Detection that something changed on screen\n\nConstraints:\n- Does not verify correctness of the resulting state\n- Must not be used alone to confirm action success when an applicable expect_* tool exists\n- For backend/API activity without a visible UI change, pass the runtime action_type into classify_action_outcome and collect network evidence only if the result remains ambiguous\n\nRecommended Usage:\n1. Capture or define the expected outcome\n2. Call an action tool\n3. Use wait_for_screen_change when transition timing is uncertain\n4. Follow with expect_screen when the expected destination is known",
1626
+ "inputSchema": {
1627
+ "type": "object",
1628
+ "properties": {
1629
+ "platform": {
1630
+ "type": "string",
1631
+ "enum": [
1632
+ "android",
1633
+ "ios"
1634
+ ],
1635
+ "description": "Optional platform override (android|ios)"
1636
+ },
1637
+ "previousFingerprint": {
1638
+ "type": "string",
1639
+ "description": "The fingerprint to compare against (required)"
1640
+ },
1641
+ "timeoutMs": {
1642
+ "type": "number",
1643
+ "description": "Timeout in ms to wait for change (default 5000)",
1644
+ "default": 5000
1645
+ },
1646
+ "pollIntervalMs": {
1647
+ "type": "number",
1648
+ "description": "Polling interval in ms (default 300)",
1649
+ "default": 300
1650
+ },
1651
+ "deviceId": {
1652
+ "type": "string",
1653
+ "description": "Optional device id/udid to target"
1654
+ }
1655
+ },
1656
+ "required": [
1657
+ "previousFingerprint"
1658
+ ],
1659
+ "allOf": [
1660
+ {
1661
+ "not": {
1662
+ "required": [
1663
+ "expectedState"
1664
+ ]
1665
+ }
1666
+ }
1667
+ ]
1668
+ }
1669
+ },
1670
+ {
1671
+ "name": "wait_for_ui_change",
1672
+ "description": "Purpose:\nWait for a non-navigation UI mutation or in-place update to become stable.\n\nInputs:\n- expected_change (optional): hierarchy_diff, text_change, or state_change\n- timeout_ms (optional)\n- stability_window_ms (optional)\n- scope (optional): screen or subtree\n- target (optional): element_id when scope=subtree\n\nGuidance:\n- Prefer wait_for_screen_change for navigation transitions.\n- Prefer wait_for_ui_change for in-place mutations and non-navigation updates.\n- Use the returned snapshot_revision as the observed synchronization point when available.\n- Scoped waits return scope-aware stability metadata and a lightweight change summary.\n\nFailure Handling:\n- TIMEOUT means the UI did not change in a stable way within the allotted time.\nSet requireReady=true to require both the existing predicate and settled UI readiness, using the same fresh samples and one timeout budget. The readiness summary explains uncertainty. Default predicate semantics are unchanged.",
1673
+ "inputSchema": {
1674
+ "type": "object",
1675
+ "properties": {
1676
+ "platform": {
1677
+ "type": "string",
1678
+ "enum": [
1679
+ "android",
1680
+ "ios"
1681
+ ],
1682
+ "description": "Optional platform override (android|ios)"
1683
+ },
1684
+ "deviceId": {
1685
+ "type": "string",
1686
+ "description": "Optional device id/udid to target"
1687
+ },
1688
+ "expected_change": {
1689
+ "type": "string",
1690
+ "enum": [
1691
+ "hierarchy_diff",
1692
+ "text_change",
1693
+ "state_change"
1694
+ ],
1695
+ "description": "Optional type of UI change to wait for"
1696
+ },
1697
+ "scope": {
1698
+ "type": "string",
1699
+ "enum": [
1700
+ "screen",
1701
+ "subtree"
1702
+ ],
1703
+ "default": "screen",
1704
+ "description": "Synchronization scope for the wait"
1705
+ },
1706
+ "target": {
1707
+ "type": "string",
1708
+ "description": "Target element_id when scope is subtree"
1709
+ },
1710
+ "timeout_ms": {
1711
+ "type": "number",
1712
+ "description": "Timeout in ms to wait for change (default 60000)",
1713
+ "default": 60000
1714
+ },
1715
+ "stability_window_ms": {
1716
+ "type": "number",
1717
+ "description": "How long the change must remain stable before success (default 300)",
1718
+ "default": 300
1719
+ },
1720
+ "requireReady": {
1721
+ "type": "boolean",
1722
+ "default": false
1723
+ }
1724
+ },
1725
+ "allOf": [
1726
+ {
1727
+ "not": {
1728
+ "required": [
1729
+ "expectedState"
1730
+ ]
1731
+ }
1732
+ }
1733
+ ]
1734
+ }
1735
+ },
1736
+ {
1737
+ "name": "expect_screen",
1738
+ "description": "Purpose:\nDeterministically verify that the intended navigation outcome of an action has occurred.\n\nInputs:\n- fingerprint: preferred exact-match screen fingerprint\n- screen: exact semantic screen identifier when a fingerprint is not available\n\nOutput Structure:\n- success: true when the expected screen matches the observed screen\n- observed_screen: current fingerprint and screen identifier\n- expected_screen: the expected fingerprint and/or screen identifier\n- confidence: 1 for an exact match, otherwise 0\n\nRecommended Usage:\n1. Define the expected screen before executing the action\n2. Resolve the target element or screen state\n3. Call an action tool such as tap_element\n4. If needed, wait for transition using wait_for_*\n5. Call expect_screen as the final verification step\n6. If success=false, treat the outcome as unverified and follow the action tool retry guidance\n\nVerification Guidance:\n- Primary and authoritative verification tool for navigation outcomes\n- Prefer fingerprint whenever you have one\n- Use screen only as a fallback exact match against known identifiers\n- Works best when the expected screen identifier is known ahead of time\n- If the expected screen is not already known, capture or define it before executing the action\n\nConstraints:\n- Returns structured binary success/failure only\n- Must not rely on natural-language interpretation or reasoning\n\nFailure Handling:\n- success=false means the expected screen was not reached; retry or recover using the action tool's failure strategy",
1739
+ "inputSchema": {
1740
+ "type": "object",
1741
+ "properties": {
1742
+ "platform": {
1743
+ "type": "string",
1744
+ "enum": [
1745
+ "android",
1746
+ "ios"
1747
+ ],
1748
+ "description": "Optional platform override (android|ios)"
1749
+ },
1750
+ "fingerprint": {
1751
+ "type": "string",
1752
+ "description": "Expected screen fingerprint. Preferred verification mechanism."
1753
+ },
1754
+ "screen": {
1755
+ "type": "string",
1756
+ "description": "Expected exact screen identifier when no fingerprint is available."
1757
+ },
1758
+ "deviceId": {
1759
+ "type": "string",
1760
+ "description": "Optional device id/udid to target"
1761
+ }
1762
+ },
1763
+ "allOf": [
1764
+ {
1765
+ "not": {
1766
+ "required": [
1767
+ "expectedState"
1768
+ ]
1769
+ }
1770
+ }
1771
+ ]
1772
+ }
1773
+ },
1774
+ {
1775
+ "name": "expect_element_visible",
1776
+ "description": "Purpose:\nDeterministically verify that the intended UI outcome of an action has occurred by confirming a target element is visible.\n\nInputs:\n- selector: required selector used to resolve the target element\n- element_id: optional previously resolved element identifier used only as context\n\nOutput Structure:\n- success: true when the element is visible\n- selector: selector used for verification\n- element_id: resolved element identifier when available\n- element: minimal resolved element info when visible\n- failure_code: TIMEOUT or UNKNOWN when verification fails\n- retryable: true when failure_code=TIMEOUT\n\nRecommended Usage:\n1. Define the expected element state before executing the action\n2. Resolve the target element or triggering control\n3. Call an action tool such as tap_element\n4. If needed, wait for UI availability using wait_for_*\n5. Call expect_element_visible as the final verification step\n6. If success=false, follow the action tool retry guidance\n\nVerification Guidance:\n- Primary and authoritative verification tool for expected element appearance or visibility\n- Use this when the screen should stay the same but the UI should reveal or update a specific element\n- selector is the primary input; element_id is an optional optimization only\n- The tool resolves the selector internally when needed\n\nConstraints:\n- Returns structured binary success/failure only\n- Must not rely on natural-language interpretation or reasoning\n\nFailure Handling:\n- TIMEOUT → retry verification once or retry the action after re-resolving\n- UNKNOWN → capture a snapshot and stop",
1777
+ "inputSchema": {
1778
+ "type": "object",
1779
+ "properties": {
1780
+ "selector": {
1781
+ "type": "object",
1782
+ "properties": {
1783
+ "text": {
1784
+ "type": "string"
1785
+ },
1786
+ "resource_id": {
1787
+ "type": "string"
1788
+ },
1789
+ "accessibility_id": {
1790
+ "type": "string"
1791
+ },
1792
+ "contains": {
1793
+ "type": "boolean",
1794
+ "default": false
1795
+ }
1796
+ }
1797
+ },
1798
+ "element_id": {
1799
+ "type": "string",
1800
+ "description": "Optional previously resolved element identifier."
1801
+ },
1802
+ "timeout_ms": {
1803
+ "type": "number",
1804
+ "default": 5000
1805
+ },
1806
+ "poll_interval_ms": {
1807
+ "type": "number",
1808
+ "default": 300
1809
+ },
1810
+ "platform": {
1811
+ "type": "string",
1812
+ "enum": [
1813
+ "android",
1814
+ "ios"
1815
+ ],
1816
+ "description": "Optional platform override"
1817
+ },
1818
+ "deviceId": {
1819
+ "type": "string",
1820
+ "description": "Optional device serial/udid"
1821
+ }
1822
+ },
1823
+ "required": [
1824
+ "selector"
1825
+ ],
1826
+ "allOf": [
1827
+ {
1828
+ "not": {
1829
+ "required": [
1830
+ "expectedState"
1831
+ ]
1832
+ }
1833
+ }
1834
+ ]
1835
+ }
1836
+ },
1837
+ {
1838
+ "name": "expect_state",
1839
+ "description": "Purpose:\nVerify a readable UI state property on the currently visible element.\n\nInputs:\n- selector or element_id\n- property\n- expected\n- platform/deviceId (optional)\n\nSupported properties:\n- checked, selected, focused, expanded, enabled, text_value, value, raw_value\n\nVerification Guidance:\n- Use this when the UI element is visible but its state must also be confirmed\n- Prefer the canonical property names above\n- The tool compares the normalized readable state and returns the observed value when available\n\nConstraints:\n- Returns structured success/failure only\n- Does not infer a state when the property is unavailable\n\nFailure Handling:\n- ELEMENT_NOT_FOUND → re-resolve the element or wait for UI stabilization\n- UNKNOWN → capture a snapshot and stop",
1840
+ "inputSchema": {
1841
+ "type": "object",
1842
+ "properties": {
1843
+ "selector": {
1844
+ "type": "object",
1845
+ "properties": {
1846
+ "text": {
1847
+ "type": "string"
1848
+ },
1849
+ "resource_id": {
1850
+ "type": "string"
1851
+ },
1852
+ "accessibility_id": {
1853
+ "type": "string"
1854
+ },
1855
+ "contains": {
1856
+ "type": "boolean",
1857
+ "default": false
1858
+ }
1859
+ }
1860
+ },
1861
+ "element_id": {
1862
+ "type": "string",
1863
+ "description": "Optional previously resolved element identifier."
1864
+ },
1865
+ "property": {
1866
+ "type": "string",
1867
+ "description": "Readable state property to verify."
1868
+ },
1869
+ "expected": {
1870
+ "description": "Expected normalized state value.",
1871
+ "oneOf": [
1872
+ {
1873
+ "type": "boolean"
1874
+ },
1875
+ {
1876
+ "type": "number"
1877
+ },
1878
+ {
1879
+ "type": "string"
1880
+ },
1881
+ {
1882
+ "type": "object"
1883
+ }
1884
+ ]
1885
+ },
1886
+ "platform": {
1887
+ "type": "string",
1888
+ "enum": [
1889
+ "android",
1890
+ "ios"
1891
+ ],
1892
+ "description": "Optional platform override"
1893
+ },
1894
+ "deviceId": {
1895
+ "type": "string",
1896
+ "description": "Optional device serial/udid"
1897
+ }
1898
+ },
1899
+ "required": [
1900
+ "property",
1901
+ "expected"
1902
+ ],
1903
+ "allOf": [
1904
+ {
1905
+ "not": {
1906
+ "required": [
1907
+ "expectedState"
1908
+ ]
1909
+ }
1910
+ }
1911
+ ]
1912
+ }
1913
+ },
1914
+ {
1915
+ "name": "adjust_control",
1916
+ "description": "Purpose:\nAdjust a numeric control value with verification.\n\nThis is the initial adjustable-control surface for slider-like controls and other controls that expose a numeric value or value_range.\n\nInputs:\n- exactly one of selector or element_id\n- property (defaults to \"value\")\n- targetValue\n- tolerance (optional; discrete default is 0, continuous default is max(step / 2, 1% of range) when omitted)\n- maxAttempts (optional; defaults to 5)\n- platform/deviceId (optional)\n\nOutput Structure:\n- action_id, timestamp (ISO 8601), action_type\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target_state / actual_state / within_tolerance / converged / attempts / adjustment_mode\n- target.selector = original selector or element handle\n- success = true when the control converges within tolerance\n\nVerification Guidance:\n- Prefer direct platform adjustment when the runtime exposes it; then verified increment/decrement actions; use coordinate fallback only as degraded mode\n- Use expect_state for the control value readback\n- Do not use derived semantic metadata as proof of success\n\nFailure Handling:\n- ELEMENT_NOT_FOUND → re-resolve the control\n- ELEMENT_NOT_INTERACTABLE → the control cannot be adjusted through the current runtime\n- CONTROL_CONVERGENCE_FAILED → the control did not converge within bounded retries or the requested value is out of range\n- UNKNOWN → capture a snapshot and stop",
1917
+ "inputSchema": {
1918
+ "type": "object",
1919
+ "properties": {
1920
+ "selector": {
1921
+ "type": "object",
1922
+ "properties": {
1923
+ "text": {
1924
+ "type": "string"
1925
+ },
1926
+ "resource_id": {
1927
+ "type": "string"
1928
+ },
1929
+ "accessibility_id": {
1930
+ "type": "string"
1931
+ },
1932
+ "contains": {
1933
+ "type": "boolean",
1934
+ "default": false
1935
+ }
1936
+ }
1937
+ },
1938
+ "element_id": {
1939
+ "type": "string",
1940
+ "description": "Optional previously resolved element identifier."
1941
+ },
1942
+ "property": {
1943
+ "type": "string",
1944
+ "description": "Readable numeric state property to adjust.",
1945
+ "default": "value"
1946
+ },
1947
+ "targetValue": {
1948
+ "type": "number",
1949
+ "description": "Target numeric value."
1950
+ },
1951
+ "tolerance": {
1952
+ "type": "number",
1953
+ "description": "Accepted numeric tolerance around the target value. Defaults are derived from the readable control domain."
1954
+ },
1955
+ "maxAttempts": {
1956
+ "type": "number",
1957
+ "description": "Maximum adjustment attempts.",
1958
+ "default": 5
1959
+ },
1960
+ "platform": {
1961
+ "type": "string",
1962
+ "enum": [
1963
+ "android",
1964
+ "ios"
1965
+ ],
1966
+ "description": "Optional platform override"
1967
+ },
1968
+ "deviceId": {
1969
+ "type": "string",
1970
+ "description": "Optional device serial/udid"
1971
+ }
1972
+ },
1973
+ "required": [
1974
+ "targetValue"
1975
+ ],
1976
+ "oneOf": [
1977
+ {
1978
+ "required": [
1979
+ "selector"
1980
+ ]
1981
+ },
1982
+ {
1983
+ "required": [
1984
+ "element_id"
1985
+ ]
1986
+ }
1987
+ ],
1988
+ "allOf": [
1989
+ {
1990
+ "not": {
1991
+ "required": [
1992
+ "expectedState"
1993
+ ]
1994
+ }
1995
+ }
1996
+ ]
1997
+ }
1998
+ },
1999
+ {
2000
+ "name": "wait_for_ui",
2001
+ "description": "Purpose:\nResolve elements and/or detect that a UI transition or availability condition has occurred.\n\nCapabilities:\n- Deterministic element resolution\n- Synchronization when element timing or availability is uncertain\n\nConstraints:\n- Does not verify correctness of the resulting state\n- Must not be used alone to confirm action success when an applicable expect_* tool exists\n\nRecommended Usage:\n1. Use wait_for_ui to resolve an element before acting or to wait for UI readiness\n2. Call the action tool\n3. If the expected outcome is known, follow with expect_* as final verification\nSet requireReady=true to require both the existing predicate and settled UI readiness, using the same fresh samples and one timeout budget. The readiness summary explains uncertainty. Default predicate semantics are unchanged.",
2002
+ "inputSchema": {
2003
+ "type": "object",
2004
+ "properties": {
2005
+ "selector": {
2006
+ "type": "object",
2007
+ "properties": {
2008
+ "text": {
2009
+ "type": "string"
2010
+ },
2011
+ "resource_id": {
2012
+ "type": "string"
2013
+ },
2014
+ "accessibility_id": {
2015
+ "type": "string"
2016
+ },
2017
+ "contains": {
2018
+ "type": "boolean",
2019
+ "description": "When true, perform substring matching",
2020
+ "default": false
2021
+ }
2022
+ }
2023
+ },
2024
+ "condition": {
2025
+ "type": "string",
2026
+ "enum": [
2027
+ "exists",
2028
+ "not_exists",
2029
+ "visible",
2030
+ "clickable"
2031
+ ],
2032
+ "default": "exists"
2033
+ },
2034
+ "timeout_ms": {
2035
+ "type": "number",
2036
+ "default": 60000
2037
+ },
2038
+ "poll_interval_ms": {
2039
+ "type": "number",
2040
+ "default": 300
2041
+ },
2042
+ "match": {
2043
+ "type": "object",
2044
+ "properties": {
2045
+ "index": {
2046
+ "type": "number"
2047
+ }
2048
+ }
2049
+ },
2050
+ "retry": {
2051
+ "type": "object",
2052
+ "properties": {
2053
+ "max_attempts": {
2054
+ "type": "number",
2055
+ "default": 1
2056
+ },
2057
+ "backoff_ms": {
2058
+ "type": "number",
2059
+ "default": 0
2060
+ }
2061
+ }
2062
+ },
2063
+ "platform": {
2064
+ "type": "string",
2065
+ "enum": [
2066
+ "android",
2067
+ "ios"
2068
+ ],
2069
+ "description": "Optional platform override"
2070
+ },
2071
+ "deviceId": {
2072
+ "type": "string",
2073
+ "description": "Optional device serial/udid"
2074
+ },
2075
+ "requireReady": {
2076
+ "type": "boolean",
2077
+ "default": false
2078
+ }
2079
+ },
2080
+ "allOf": [
2081
+ {
2082
+ "not": {
2083
+ "required": [
2084
+ "expectedState"
2085
+ ]
2086
+ }
2087
+ }
2088
+ ]
2089
+ }
2090
+ },
2091
+ {
2092
+ "name": "find_element",
2093
+ "description": "Find a UI element by semantic query (text, content-desc, resource-id, class).\n\nReturns the best match plus resolution metadata when available, including confidence, selection reason, and fallback alternates.",
2094
+ "inputSchema": {
2095
+ "type": "object",
2096
+ "properties": {
2097
+ "query": {
2098
+ "type": "string",
2099
+ "description": "Search query (text or label)"
2100
+ },
2101
+ "exact": {
2102
+ "type": "boolean",
2103
+ "description": "Require exact match (true/false)",
2104
+ "default": false
2105
+ },
2106
+ "timeoutMs": {
2107
+ "type": "number",
2108
+ "description": "Timeout in ms to keep searching",
2109
+ "default": 3000
2110
+ },
2111
+ "platform": {
2112
+ "type": "string",
2113
+ "enum": [
2114
+ "android",
2115
+ "ios"
2116
+ ],
2117
+ "description": "Optional platform override"
2118
+ },
2119
+ "deviceId": {
2120
+ "type": "string",
2121
+ "description": "Optional device serial/udid"
2122
+ }
2123
+ },
2124
+ "required": [
2125
+ "query"
2126
+ ],
2127
+ "allOf": [
2128
+ {
2129
+ "not": {
2130
+ "required": [
2131
+ "expectedState"
2132
+ ]
2133
+ }
2134
+ }
2135
+ ]
2136
+ }
2137
+ },
2138
+ {
2139
+ "name": "tap",
2140
+ "description": "Purpose:\nDispatch a tap at specific screen coordinates.\n\nInputs:\n- x, y coordinates\n- platform (optional)\n- deviceId (optional)\n\nOutput Structure:\n - action_id, timestamp (ISO 8601), action_type\n - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n - source_module: runtime source of the action envelope\n - target.selector = { x, y }\n- success = true when the tap was dispatched\n- failure_code/retryable when dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Resolve coordinates deterministically\n2. Call tap\n3. If needed, wait for transition using wait_for_*\n4. Verify with expect_screen or expect_element_visible depending on the intended outcome\n\nVerification Guidance:\n- Prefer tap_element over tap when an element can be resolved\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Use expect_screen for navigation and expect_element_visible for local UI changes\n- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → capture a snapshot and stop\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.",
2141
+ "inputSchema": {
2142
+ "type": "object",
2143
+ "properties": {
2144
+ "platform": {
2145
+ "type": "string",
2146
+ "enum": [
2147
+ "android",
2148
+ "ios"
2149
+ ],
2150
+ "description": "Platform to tap on"
2151
+ },
2152
+ "x": {
2153
+ "type": "number",
2154
+ "description": "X coordinate"
2155
+ },
2156
+ "y": {
2157
+ "type": "number",
2158
+ "description": "Y coordinate"
2159
+ },
2160
+ "deviceId": {
2161
+ "type": "string",
2162
+ "description": "Device Serial/UDID. Defaults to connected/booted device."
2163
+ },
2164
+ "verificationMode": {
2165
+ "type": "string",
2166
+ "enum": [
2167
+ "none",
2168
+ "light",
2169
+ "full"
2170
+ ],
2171
+ "default": "full"
2172
+ },
2173
+ "responseMode": {
2174
+ "type": "string",
2175
+ "enum": [
2176
+ "compact",
2177
+ "debug"
2178
+ ],
2179
+ "default": "debug"
2180
+ },
2181
+ "actionTimeoutMs": {
2182
+ "type": "integer",
2183
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2184
+ },
2185
+ "verificationTimeoutMs": {
2186
+ "type": "integer",
2187
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2188
+ },
2189
+ "expectedState": {
2190
+ "type": "object",
2191
+ "additionalProperties": false,
2192
+ "properties": {
2193
+ "snapshotSessionId": {
2194
+ "type": "string",
2195
+ "minLength": 1
2196
+ },
2197
+ "snapshotRevision": {
2198
+ "type": "integer",
2199
+ "minimum": 1,
2200
+ "maximum": 9007199254740991
2201
+ },
2202
+ "timeoutMs": {
2203
+ "type": "integer",
2204
+ "minimum": 100,
2205
+ "maximum": 60000,
2206
+ "default": 15000
2207
+ }
2208
+ },
2209
+ "required": [
2210
+ "snapshotSessionId",
2211
+ "snapshotRevision"
2212
+ ]
2213
+ }
2214
+ },
2215
+ "required": [
2216
+ "x",
2217
+ "y"
2218
+ ],
2219
+ "allOf": [
2220
+ {
2221
+ "if": {
2222
+ "required": [
2223
+ "expectedState"
2224
+ ]
2225
+ },
2226
+ "then": {
2227
+ "required": [
2228
+ "platform",
2229
+ "deviceId"
2230
+ ],
2231
+ "properties": {
2232
+ "platform": {
2233
+ "enum": [
2234
+ "android",
2235
+ "ios"
2236
+ ]
2237
+ },
2238
+ "deviceId": {
2239
+ "type": "string",
2240
+ "minLength": 1,
2241
+ "pattern": "\\S",
2242
+ "not": {
2243
+ "enum": [
2244
+ "booted",
2245
+ "default"
2246
+ ]
2247
+ }
2248
+ }
2249
+ }
2250
+ }
2251
+ }
2252
+ ]
2253
+ }
2254
+ },
2255
+ {
2256
+ "name": "tap_element",
2257
+ "description": "Purpose:\nTap a previously resolved UI element using its elementId.\n\nInputs:\n- elementId: a resolved UI element identifier returned by wait_for_ui\n\nOutput Structure:\n- action_id: unique timestamp-based action identifier\n- timestamp: ISO 8601 timestamp for the action attempt\n- action_type: \"tap_element\"\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target.selector: original target handle ({ elementId })\n- target.resolved: minimal resolved element info used for the tap\n- success: true when the tap was dispatched\n- failure_code: present when success=false\n- retryable: present when failure_code exists\n- ui_fingerprint_before/ui_fingerprint_after: optional fingerprints captured around the action\n\nRecommended Usage:\n1. Resolve the target with wait_for_ui or another deterministic resolver\n2. Call tap_element\n3. If needed, wait for transition using wait_for_*\n4. Verify outcome using expect_*\n - use expect_screen when navigation is expected\n - use expect_element_visible when the UI change is local\n5. If verification fails, inspect failure_code and follow the retry strategy below\n\nVerification Guidance:\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Prefer expect_screen for navigation or modal transitions\n- Prefer expect_element_visible when the tap should reveal or update a specific element\n- wait_for_* may be used for resolution and synchronization, but not as the final verification step when an applicable expect_* tool exists\n- Do not treat tap_element.success as outcome success; it only means the tap was executed\n\nFailure Handling:\n- STALE_REFERENCE → re-resolve the element, then retry\n- ELEMENT_NOT_INTERACTABLE → wait or refine the target, then retry\n- UNKNOWN → capture a snapshot and stop\n\nThis tool reports execution success only. Verification must be done with a separate expect_* tool.\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.",
2258
+ "inputSchema": {
2259
+ "type": "object",
2260
+ "properties": {
2261
+ "elementId": {
2262
+ "type": "string",
2263
+ "description": "A unique element identifier returned by wait_for_ui"
2264
+ },
2265
+ "selector": {
2266
+ "type": "object",
2267
+ "properties": {
2268
+ "text": {
2269
+ "type": "string"
2270
+ },
2271
+ "resource_id": {
2272
+ "type": "string"
2273
+ },
2274
+ "accessibility_id": {
2275
+ "type": "string"
2276
+ },
2277
+ "contains": {
2278
+ "type": "boolean"
2279
+ }
2280
+ }
2281
+ },
2282
+ "waitFor": {
2283
+ "type": "object",
2284
+ "properties": {
2285
+ "condition": {
2286
+ "type": "string",
2287
+ "enum": [
2288
+ "exists",
2289
+ "visible",
2290
+ "clickable"
2291
+ ]
2292
+ },
2293
+ "timeoutMs": {
2294
+ "type": "number",
2295
+ "minimum": 100,
2296
+ "maximum": 10000
2297
+ },
2298
+ "pollIntervalMs": {
2299
+ "type": "number",
2300
+ "minimum": 50,
2301
+ "maximum": 1000
2302
+ },
2303
+ "match": {
2304
+ "type": "object",
2305
+ "properties": {
2306
+ "index": {
2307
+ "type": "number"
2308
+ }
2309
+ }
2310
+ }
2311
+ }
2312
+ },
2313
+ "platform": {
2314
+ "type": "string",
2315
+ "enum": [
2316
+ "android",
2317
+ "ios"
2318
+ ]
2319
+ },
2320
+ "deviceId": {
2321
+ "type": "string"
2322
+ },
2323
+ "verificationMode": {
2324
+ "type": "string",
2325
+ "enum": [
2326
+ "none",
2327
+ "light",
2328
+ "full"
2329
+ ],
2330
+ "default": "full"
2331
+ },
2332
+ "responseMode": {
2333
+ "type": "string",
2334
+ "enum": [
2335
+ "compact",
2336
+ "debug"
2337
+ ],
2338
+ "default": "debug"
2339
+ },
2340
+ "expectedState": {
2341
+ "type": "object",
2342
+ "additionalProperties": false,
2343
+ "properties": {
2344
+ "snapshotSessionId": {
2345
+ "type": "string",
2346
+ "minLength": 1
2347
+ },
2348
+ "snapshotRevision": {
2349
+ "type": "integer",
2350
+ "minimum": 1,
2351
+ "maximum": 9007199254740991
2352
+ },
2353
+ "timeoutMs": {
2354
+ "type": "integer",
2355
+ "minimum": 100,
2356
+ "maximum": 60000,
2357
+ "default": 15000
2358
+ }
2359
+ },
2360
+ "required": [
2361
+ "snapshotSessionId",
2362
+ "snapshotRevision"
2363
+ ]
2364
+ },
2365
+ "actionTimeoutMs": {
2366
+ "type": "integer",
2367
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2368
+ },
2369
+ "verificationTimeoutMs": {
2370
+ "type": "integer",
2371
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2372
+ }
2373
+ },
2374
+ "allOf": [
2375
+ {
2376
+ "if": {
2377
+ "required": [
2378
+ "expectedState"
2379
+ ]
2380
+ },
2381
+ "then": {
2382
+ "required": [
2383
+ "platform",
2384
+ "deviceId"
2385
+ ],
2386
+ "properties": {
2387
+ "platform": {
2388
+ "enum": [
2389
+ "android",
2390
+ "ios"
2391
+ ]
2392
+ },
2393
+ "deviceId": {
2394
+ "type": "string",
2395
+ "minLength": 1,
2396
+ "pattern": "\\S",
2397
+ "not": {
2398
+ "enum": [
2399
+ "booted",
2400
+ "default"
2401
+ ]
2402
+ }
2403
+ }
2404
+ }
2405
+ }
2406
+ }
2407
+ ],
2408
+ "oneOf": [
2409
+ {
2410
+ "required": [
2411
+ "elementId"
2412
+ ],
2413
+ "not": {
2414
+ "required": [
2415
+ "selector"
2416
+ ]
2417
+ }
2418
+ },
2419
+ {
2420
+ "required": [
2421
+ "selector"
2422
+ ],
2423
+ "not": {
2424
+ "required": [
2425
+ "elementId"
2426
+ ]
2427
+ }
2428
+ }
2429
+ ]
2430
+ }
2431
+ },
2432
+ {
2433
+ "name": "swipe",
2434
+ "description": "Purpose:\nDispatch a swipe gesture on Android or iOS.\n\nInputs:\n- start and end coordinates\n- duration\n- platform/deviceId (optional)\n\nOutput Structure:\n- action_id, timestamp (ISO 8601), action_type\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target.selector = { x1, y1, x2, y2, duration }\n- success = true when the swipe was dispatched\n- failure_code/retryable when dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Determine swipe coordinates\n2. Call swipe\n3. If needed, wait for transition using wait_for_*\n4. Verify with expect_screen or expect_element_visible when a deterministic outcome is expected\n\nVerification Guidance:\n- Swipe outcomes are less predictable; choose the most specific verifier available for the intended effect\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → capture a snapshot and stop\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.",
2435
+ "inputSchema": {
2436
+ "type": "object",
2437
+ "properties": {
2438
+ "platform": {
2439
+ "type": "string",
2440
+ "enum": [
2441
+ "android",
2442
+ "ios"
2443
+ ],
2444
+ "description": "Platform to swipe on (android or ios)"
2445
+ },
2446
+ "x1": {
2447
+ "type": "number",
2448
+ "description": "Start X coordinate"
2449
+ },
2450
+ "y1": {
2451
+ "type": "number",
2452
+ "description": "Start Y coordinate"
2453
+ },
2454
+ "x2": {
2455
+ "type": "number",
2456
+ "description": "End X coordinate"
2457
+ },
2458
+ "y2": {
2459
+ "type": "number",
2460
+ "description": "End Y coordinate"
2461
+ },
2462
+ "duration": {
2463
+ "type": "number",
2464
+ "description": "Duration in ms"
2465
+ },
2466
+ "deviceId": {
2467
+ "type": "string",
2468
+ "description": "Device Serial/UDID. Defaults to connected/booted device."
2469
+ },
2470
+ "expectedState": {
2471
+ "type": "object",
2472
+ "additionalProperties": false,
2473
+ "properties": {
2474
+ "snapshotSessionId": {
2475
+ "type": "string",
2476
+ "minLength": 1
2477
+ },
2478
+ "snapshotRevision": {
2479
+ "type": "integer",
2480
+ "minimum": 1,
2481
+ "maximum": 9007199254740991
2482
+ },
2483
+ "timeoutMs": {
2484
+ "type": "integer",
2485
+ "minimum": 100,
2486
+ "maximum": 60000,
2487
+ "default": 15000
2488
+ }
2489
+ },
2490
+ "required": [
2491
+ "snapshotSessionId",
2492
+ "snapshotRevision"
2493
+ ]
2494
+ },
2495
+ "verificationMode": {
2496
+ "type": "string",
2497
+ "enum": [
2498
+ "none",
2499
+ "light",
2500
+ "full"
2501
+ ],
2502
+ "default": "full"
2503
+ },
2504
+ "responseMode": {
2505
+ "type": "string",
2506
+ "enum": [
2507
+ "compact",
2508
+ "debug"
2509
+ ],
2510
+ "default": "debug"
2511
+ },
2512
+ "actionTimeoutMs": {
2513
+ "type": "integer",
2514
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2515
+ },
2516
+ "verificationTimeoutMs": {
2517
+ "type": "integer",
2518
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2519
+ }
2520
+ },
2521
+ "required": [
2522
+ "x1",
2523
+ "y1",
2524
+ "x2",
2525
+ "y2",
2526
+ "duration"
2527
+ ],
2528
+ "allOf": [
2529
+ {
2530
+ "if": {
2531
+ "required": [
2532
+ "expectedState"
2533
+ ]
2534
+ },
2535
+ "then": {
2536
+ "required": [
2537
+ "platform",
2538
+ "deviceId"
2539
+ ],
2540
+ "properties": {
2541
+ "platform": {
2542
+ "enum": [
2543
+ "android",
2544
+ "ios"
2545
+ ]
2546
+ },
2547
+ "deviceId": {
2548
+ "type": "string",
2549
+ "minLength": 1,
2550
+ "pattern": "\\S",
2551
+ "not": {
2552
+ "enum": [
2553
+ "booted",
2554
+ "default"
2555
+ ]
2556
+ }
2557
+ }
2558
+ }
2559
+ }
2560
+ }
2561
+ ]
2562
+ }
2563
+ },
2564
+ {
2565
+ "name": "scroll_to_element",
2566
+ "description": "Purpose:\nScroll until a target element becomes visible.\n\nInputs:\n- platform\n- selector\n- direction, maxScrolls, scrollAmount, deviceId (optional)\n\nOutput Structure:\n- action_id, timestamp (ISO 8601), action_type\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target.selector = original selector\n- target.resolved = minimal resolved element info when found\n- success = true when scrolling produced a visible target element\n- failure_code/retryable when the target was not reached\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Resolve the target selector\n2. Call scroll_to_element\n3. If needed, wait for UI stabilization using wait_for_*\n4. Verify with expect_element_visible when the expected element visibility is known\n5. If success=false, follow failure handling before retrying\n\nVerification Guidance:\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Use expect_element_visible when you need an explicit post-scroll confirmation\n- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists\n\nFailure Handling:\n- NAVIGATION_NO_CHANGE → adjust scroll direction or stop\n- TIMEOUT → retry with refined selector or larger scroll budget\n- UNKNOWN → capture a snapshot and stop",
2567
+ "inputSchema": {
2568
+ "type": "object",
2569
+ "properties": {
2570
+ "platform": {
2571
+ "type": "string",
2572
+ "enum": [
2573
+ "android",
2574
+ "ios"
2575
+ ],
2576
+ "description": "Platform to operate on (required)"
2577
+ },
2578
+ "selector": {
2579
+ "type": "object",
2580
+ "properties": {
2581
+ "text": {
2582
+ "type": "string"
2583
+ },
2584
+ "resourceId": {
2585
+ "type": "string"
2586
+ },
2587
+ "contentDesc": {
2588
+ "type": "string"
2589
+ },
2590
+ "className": {
2591
+ "type": "string"
2592
+ }
2593
+ }
2594
+ },
2595
+ "direction": {
2596
+ "type": "string",
2597
+ "enum": [
2598
+ "down",
2599
+ "up"
2600
+ ],
2601
+ "default": "down"
2602
+ },
2603
+ "maxScrolls": {
2604
+ "type": "number",
2605
+ "default": 10
2606
+ },
2607
+ "scrollAmount": {
2608
+ "type": "number",
2609
+ "default": 0.7
2610
+ },
2611
+ "deviceId": {
2612
+ "type": "string",
2613
+ "description": "Device UDID (iOS) or Serial (Android). Defaults to booted/connected."
2614
+ },
2615
+ "verificationMode": {
2616
+ "type": "string",
2617
+ "enum": [
2618
+ "none",
2619
+ "light",
2620
+ "full"
2621
+ ],
2622
+ "default": "full"
2623
+ },
2624
+ "responseMode": {
2625
+ "type": "string",
2626
+ "enum": [
2627
+ "compact",
2628
+ "debug"
2629
+ ],
2630
+ "default": "debug"
2631
+ },
2632
+ "actionTimeoutMs": {
2633
+ "type": "integer",
2634
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2635
+ },
2636
+ "verificationTimeoutMs": {
2637
+ "type": "integer",
2638
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2639
+ }
2640
+ },
2641
+ "required": [
2642
+ "platform",
2643
+ "selector"
2644
+ ],
2645
+ "allOf": [
2646
+ {
2647
+ "not": {
2648
+ "required": [
2649
+ "expectedState"
2650
+ ]
2651
+ }
2652
+ }
2653
+ ]
2654
+ }
2655
+ },
2656
+ {
2657
+ "name": "type_text",
2658
+ "description": "Purpose:\nType text into the currently focused Android input field.\n\nInputs:\n- text\n- platform/deviceId (optional)\n\nOutput Structure:\n- action_id, timestamp (ISO 8601), action_type\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target.selector = { text }\n- success = true when text input was dispatched\n- failure_code/retryable when dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Resolve or focus the target input first\n2. Call type_text\n3. If needed, wait for UI stabilization using wait_for_*\n4. Verify with expect_element_visible or expect_screen, depending on the intended outcome\n\nVerification Guidance:\n- Prefer verifying the next expected element or screen state instead of inferring success from the text action alone\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → re-focus the input or capture a snapshot\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.",
2659
+ "inputSchema": {
2660
+ "type": "object",
2661
+ "properties": {
2662
+ "platform": {
2663
+ "type": "string",
2664
+ "enum": [
2665
+ "android"
2666
+ ],
2667
+ "description": "Platform to type on (currently only android supported)"
2668
+ },
2669
+ "text": {
2670
+ "type": "string",
2671
+ "description": "The text to type"
2672
+ },
2673
+ "deviceId": {
2674
+ "type": "string",
2675
+ "description": "Device Serial/UDID. Defaults to connected/booted device."
2676
+ },
2677
+ "expectedState": {
2678
+ "type": "object",
2679
+ "additionalProperties": false,
2680
+ "properties": {
2681
+ "snapshotSessionId": {
2682
+ "type": "string",
2683
+ "minLength": 1
2684
+ },
2685
+ "snapshotRevision": {
2686
+ "type": "integer",
2687
+ "minimum": 1,
2688
+ "maximum": 9007199254740991
2689
+ },
2690
+ "timeoutMs": {
2691
+ "type": "integer",
2692
+ "minimum": 100,
2693
+ "maximum": 60000,
2694
+ "default": 15000
2695
+ }
2696
+ },
2697
+ "required": [
2698
+ "snapshotSessionId",
2699
+ "snapshotRevision"
2700
+ ]
2701
+ },
2702
+ "verificationMode": {
2703
+ "type": "string",
2704
+ "enum": [
2705
+ "none",
2706
+ "light",
2707
+ "full"
2708
+ ],
2709
+ "default": "full"
2710
+ },
2711
+ "responseMode": {
2712
+ "type": "string",
2713
+ "enum": [
2714
+ "compact",
2715
+ "debug"
2716
+ ],
2717
+ "default": "debug"
2718
+ },
2719
+ "actionTimeoutMs": {
2720
+ "type": "integer",
2721
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2722
+ },
2723
+ "verificationTimeoutMs": {
2724
+ "type": "integer",
2725
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2726
+ }
2727
+ },
2728
+ "required": [
2729
+ "text"
2730
+ ],
2731
+ "allOf": [
2732
+ {
2733
+ "if": {
2734
+ "required": [
2735
+ "expectedState"
2736
+ ]
2737
+ },
2738
+ "then": {
2739
+ "required": [
2740
+ "platform",
2741
+ "deviceId"
2742
+ ],
2743
+ "properties": {
2744
+ "platform": {
2745
+ "enum": [
2746
+ "android"
2747
+ ]
2748
+ },
2749
+ "deviceId": {
2750
+ "type": "string",
2751
+ "minLength": 1,
2752
+ "pattern": "\\S",
2753
+ "not": {
2754
+ "enum": [
2755
+ "booted",
2756
+ "default"
2757
+ ]
2758
+ }
2759
+ }
2760
+ }
2761
+ }
2762
+ }
2763
+ ]
2764
+ }
2765
+ },
2766
+ {
2767
+ "name": "press_back",
2768
+ "description": "Purpose:\nDispatch the Android Back action.\n\nInputs:\n- platform/deviceId (optional)\n\nOutput Structure:\n- action_id, timestamp (ISO 8601), action_type\n- lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)\n- source_module: runtime source of the action envelope\n- target.selector = { key: \"back\" }\n- success = true when the back action was dispatched\n- failure_code/retryable when dispatch fails\n- ui_fingerprint_before/ui_fingerprint_after when available\n\nRecommended Usage:\n1. Call press_back\n2. If needed, wait for transition using wait_for_*\n3. Verify with expect_screen when a known destination is expected\n4. If verification fails, retry once or recover explicitly\n\nVerification Guidance:\n- Back outcomes can vary by screen, so verify against the intended destination when possible\n- Follow RESOLVE → ACT → WAIT (if needed) → EXPECT\n- Do not use wait_for_* alone as final verification when an applicable expect_* tool exists\n\nFailure Handling:\n- TIMEOUT → retry once\n- UNKNOWN → capture a snapshot and stop\n\nConditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures include the fresh UI tree. This is not atomic with OS input delivery.",
2769
+ "inputSchema": {
2770
+ "type": "object",
2771
+ "properties": {
2772
+ "platform": {
2773
+ "type": "string",
2774
+ "enum": [
2775
+ "android"
2776
+ ],
2777
+ "description": "Platform (currently only android supported)"
2778
+ },
2779
+ "deviceId": {
2780
+ "type": "string",
2781
+ "description": "Device Serial/UDID. Defaults to connected/booted device."
2782
+ },
2783
+ "expectedState": {
2784
+ "type": "object",
2785
+ "additionalProperties": false,
2786
+ "properties": {
2787
+ "snapshotSessionId": {
2788
+ "type": "string",
2789
+ "minLength": 1
2790
+ },
2791
+ "snapshotRevision": {
2792
+ "type": "integer",
2793
+ "minimum": 1,
2794
+ "maximum": 9007199254740991
2795
+ },
2796
+ "timeoutMs": {
2797
+ "type": "integer",
2798
+ "minimum": 100,
2799
+ "maximum": 60000,
2800
+ "default": 15000
2801
+ }
2802
+ },
2803
+ "required": [
2804
+ "snapshotSessionId",
2805
+ "snapshotRevision"
2806
+ ]
2807
+ },
2808
+ "verificationMode": {
2809
+ "type": "string",
2810
+ "enum": [
2811
+ "none",
2812
+ "light",
2813
+ "full"
2814
+ ],
2815
+ "default": "full"
2816
+ },
2817
+ "responseMode": {
2818
+ "type": "string",
2819
+ "enum": [
2820
+ "compact",
2821
+ "debug"
2822
+ ],
2823
+ "default": "debug"
2824
+ },
2825
+ "actionTimeoutMs": {
2826
+ "type": "integer",
2827
+ "description": "Dispatch budget in milliseconds, clamped to 100–30000."
2828
+ },
2829
+ "verificationTimeoutMs": {
2830
+ "type": "integer",
2831
+ "description": "Light observation budget in milliseconds, clamped to 100–60000."
2832
+ }
2833
+ },
2834
+ "allOf": [
2835
+ {
2836
+ "if": {
2837
+ "required": [
2838
+ "expectedState"
2839
+ ]
2840
+ },
2841
+ "then": {
2842
+ "required": [
2843
+ "platform",
2844
+ "deviceId"
2845
+ ],
2846
+ "properties": {
2847
+ "platform": {
2848
+ "enum": [
2849
+ "android"
2850
+ ]
2851
+ },
2852
+ "deviceId": {
2853
+ "type": "string",
2854
+ "minLength": 1,
2855
+ "pattern": "\\S",
2856
+ "not": {
2857
+ "enum": [
2858
+ "booted",
2859
+ "default"
2860
+ ]
2861
+ }
2862
+ }
2863
+ }
2864
+ }
2865
+ }
2866
+ ]
2867
+ }
2868
+ },
2869
+ {
2870
+ "name": "classify_action_outcome",
2871
+ "description": "Classify the outcome of the most recent action into exactly one of: success, no_op, backend_failure, ui_failure, unknown.\n\nUse the runtime action result's `action_type` as `actionType` so the classifier can distinguish local-state actions from side-effect actions.\nUse this when the intended outcome is not already fully verified by the UI signal alone.\nFor backend/API activity, compare get_screen_fingerprint before and after the action and call get_network_activity immediately after the action if the outcome is still ambiguous.\n\nHOW TO GATHER INPUTS before calling:\n1. Call wait_for_screen_change or compare get_screen_fingerprint before/after — set uiChanged accordingly.\n2. If you checked for a specific element with wait_for_ui, set expectedElementVisible.\n3. Pass actionType from the action response when available.\n4. Only provide networkRequests if you already collected them or want to classify a side-effect action with backend evidence.\n\nRULES (applied in order — stop at first match):\n1. If uiChanged=true OR expectedElementVisible=true → outcome=success\n2. If actionType is missing → outcome=unknown\n3. If any request has status=failure or retryable → outcome=backend_failure\n4. If actionType maps to a local-state action → outcome=no_op; prefer state-based verification and avoid default network fallback\n5. If actionType maps to a side-effect action and no networkRequests were supplied → outcome=unknown\n6. If no requests returned → outcome=no_op\n7. If all requests succeeded → outcome=ui_failure\n8. Otherwise → outcome=unknown\n\nBEHAVIOUR after outcome:\n- success → continue\n- no_op → retry with richer state verification or re-resolve the element\n- backend_failure → stop and report the failing endpoint\n- ui_failure → stop and report failure\n- unknown → take one recovery step (e.g. capture_debug_snapshot), then stop",
2872
+ "inputSchema": {
2873
+ "type": "object",
2874
+ "properties": {
2875
+ "uiChanged": {
2876
+ "type": "boolean",
2877
+ "description": "true if the screen fingerprint or activity changed after the action. Use wait_for_screen_change or compare get_screen_fingerprint before and after."
2878
+ },
2879
+ "expectedElementVisible": {
2880
+ "type": "boolean",
2881
+ "description": "true if the element you expected to appear is now visible (from wait_for_ui). Omit if you did not check for a specific element."
2882
+ },
2883
+ "actionType": {
2884
+ "type": "string",
2885
+ "description": "The runtime action_type from the action response (for example tap, tap_element, swipe, type_text, press_back, start_app)."
2886
+ },
2887
+ "networkRequests": {
2888
+ "type": "array",
2889
+ "description": "Optional network evidence collected after the action. Use it when the expected outcome is backend/API activity or when the UI signal is ambiguous.",
2890
+ "items": {
2891
+ "type": "object",
2892
+ "properties": {
2893
+ "endpoint": {
2894
+ "type": "string",
2895
+ "description": "Request endpoint or full URL"
2896
+ },
2897
+ "status": {
2898
+ "type": "string",
2899
+ "enum": [
2900
+ "success",
2901
+ "failure",
2902
+ "retryable"
2903
+ ],
2904
+ "description": "Outcome of the request"
2905
+ }
2906
+ },
2907
+ "required": [
2908
+ "endpoint",
2909
+ "status"
2910
+ ]
2911
+ }
2912
+ },
2913
+ "hasLogErrors": {
2914
+ "type": "boolean",
2915
+ "description": "true if structured log errors were observed (e.g. from read_log_stream). Optional — include if you have already read logs."
2916
+ }
2917
+ },
2918
+ "required": [
2919
+ "uiChanged"
2920
+ ],
2921
+ "allOf": [
2922
+ {
2923
+ "not": {
2924
+ "required": [
2925
+ "expectedState"
2926
+ ]
2927
+ }
2928
+ }
2929
+ ]
2930
+ }
2931
+ },
2932
+ {
2933
+ "name": "run_journey",
2934
+ "description": "Run an ordered, bounded sequence of start_app, tap, wait, and deterministic assertion steps against one device. Stops after the first failed step.\nTap steps may include expectedState from a successful same-device get_ui_tree. A failed condition blocks that input, retains fresh condition evidence even in compact mode, and stops subsequent steps. Conditions are not journey defaults or supported on other step types.",
2935
+ "inputSchema": {
2936
+ "type": "object",
2937
+ "properties": {
2938
+ "platform": {
2939
+ "type": "string",
2940
+ "enum": [
2941
+ "android",
2942
+ "ios"
2943
+ ]
2944
+ },
2945
+ "deviceId": {
2946
+ "type": "string"
2947
+ },
2948
+ "responseMode": {
2949
+ "type": "string",
2950
+ "enum": [
2951
+ "compact",
2952
+ "debug"
2953
+ ],
2954
+ "default": "compact"
2955
+ },
2956
+ "steps": {
2957
+ "type": "array",
2958
+ "minItems": 1,
2959
+ "maxItems": 50,
2960
+ "items": {
2961
+ "oneOf": [
2962
+ {
2963
+ "type": "object",
2964
+ "additionalProperties": false,
2965
+ "properties": {
2966
+ "id": {
2967
+ "type": "string",
2968
+ "minLength": 1
2969
+ },
2970
+ "type": {
2971
+ "const": "start_app"
2972
+ },
2973
+ "appId": {
2974
+ "type": "string",
2975
+ "minLength": 1
2976
+ },
2977
+ "verificationMode": {
2978
+ "type": "string",
2979
+ "enum": [
2980
+ "none",
2981
+ "light",
2982
+ "full"
2983
+ ]
2984
+ }
2985
+ },
2986
+ "required": [
2987
+ "id",
2988
+ "type",
2989
+ "appId"
2990
+ ]
2991
+ },
2992
+ {
2993
+ "type": "object",
2994
+ "additionalProperties": false,
2995
+ "properties": {
2996
+ "id": {
2997
+ "type": "string",
2998
+ "minLength": 1
2999
+ },
3000
+ "type": {
3001
+ "const": "tap"
3002
+ },
3003
+ "selector": {
3004
+ "type": "object",
3005
+ "additionalProperties": false,
3006
+ "properties": {
3007
+ "text": {
3008
+ "type": "string",
3009
+ "minLength": 1
3010
+ },
3011
+ "resource_id": {
3012
+ "type": "string",
3013
+ "minLength": 1
3014
+ },
3015
+ "accessibility_id": {
3016
+ "type": "string",
3017
+ "minLength": 1
3018
+ },
3019
+ "contains": {
3020
+ "type": "boolean"
3021
+ }
3022
+ },
3023
+ "anyOf": [
3024
+ {
3025
+ "required": [
3026
+ "text"
3027
+ ]
3028
+ },
3029
+ {
3030
+ "required": [
3031
+ "resource_id"
3032
+ ]
3033
+ },
3034
+ {
3035
+ "required": [
3036
+ "accessibility_id"
3037
+ ]
3038
+ }
3039
+ ]
3040
+ },
3041
+ "elementId": {
3042
+ "type": "string",
3043
+ "minLength": 1
3044
+ },
3045
+ "verificationMode": {
3046
+ "type": "string",
3047
+ "enum": [
3048
+ "none",
3049
+ "light",
3050
+ "full"
3051
+ ]
3052
+ },
3053
+ "expectedState": {
3054
+ "type": "object",
3055
+ "additionalProperties": false,
3056
+ "properties": {
3057
+ "snapshotSessionId": {
3058
+ "type": "string",
3059
+ "minLength": 1
3060
+ },
3061
+ "snapshotRevision": {
3062
+ "type": "integer",
3063
+ "minimum": 1,
3064
+ "maximum": 9007199254740991
3065
+ },
3066
+ "timeoutMs": {
3067
+ "type": "integer",
3068
+ "minimum": 100,
3069
+ "maximum": 60000,
3070
+ "default": 15000
3071
+ }
3072
+ },
3073
+ "required": [
3074
+ "snapshotSessionId",
3075
+ "snapshotRevision"
3076
+ ]
3077
+ },
3078
+ "waitFor": {
3079
+ "type": "object",
3080
+ "additionalProperties": false,
3081
+ "properties": {
3082
+ "timeoutMs": {
3083
+ "type": "integer",
3084
+ "minimum": 100,
3085
+ "maximum": 10000
3086
+ },
3087
+ "pollIntervalMs": {
3088
+ "type": "integer",
3089
+ "minimum": 50,
3090
+ "maximum": 1000
3091
+ },
3092
+ "condition": {
3093
+ "enum": [
3094
+ "exists",
3095
+ "visible",
3096
+ "clickable"
3097
+ ]
3098
+ },
3099
+ "match": {
3100
+ "type": "object",
3101
+ "additionalProperties": false,
3102
+ "properties": {
3103
+ "index": {
3104
+ "type": "integer",
3105
+ "minimum": 0
3106
+ }
3107
+ },
3108
+ "required": []
3109
+ }
3110
+ },
3111
+ "required": []
3112
+ }
3113
+ },
3114
+ "required": [
3115
+ "id",
3116
+ "type"
3117
+ ],
3118
+ "oneOf": [
3119
+ {
3120
+ "required": [
3121
+ "selector"
3122
+ ],
3123
+ "not": {
3124
+ "required": [
3125
+ "elementId"
3126
+ ]
3127
+ }
3128
+ },
3129
+ {
3130
+ "required": [
3131
+ "elementId"
3132
+ ],
3133
+ "not": {
3134
+ "required": [
3135
+ "selector"
3136
+ ]
3137
+ }
3138
+ }
3139
+ ]
3140
+ },
3141
+ {
3142
+ "type": "object",
3143
+ "additionalProperties": false,
3144
+ "properties": {
3145
+ "id": {
3146
+ "type": "string",
3147
+ "minLength": 1
3148
+ },
3149
+ "type": {
3150
+ "const": "wait"
3151
+ },
3152
+ "selector": {
3153
+ "type": "object",
3154
+ "additionalProperties": false,
3155
+ "properties": {
3156
+ "text": {
3157
+ "type": "string",
3158
+ "minLength": 1
3159
+ },
3160
+ "resource_id": {
3161
+ "type": "string",
3162
+ "minLength": 1
3163
+ },
3164
+ "accessibility_id": {
3165
+ "type": "string",
3166
+ "minLength": 1
3167
+ },
3168
+ "contains": {
3169
+ "type": "boolean"
3170
+ }
3171
+ },
3172
+ "anyOf": [
3173
+ {
3174
+ "required": [
3175
+ "text"
3176
+ ]
3177
+ },
3178
+ {
3179
+ "required": [
3180
+ "resource_id"
3181
+ ]
3182
+ },
3183
+ {
3184
+ "required": [
3185
+ "accessibility_id"
3186
+ ]
3187
+ }
3188
+ ]
3189
+ },
3190
+ "condition": {
3191
+ "enum": [
3192
+ "exists",
3193
+ "not_exists",
3194
+ "visible",
3195
+ "clickable"
3196
+ ]
3197
+ },
3198
+ "timeoutMs": {
3199
+ "type": "integer",
3200
+ "minimum": 100,
3201
+ "maximum": 60000
3202
+ },
3203
+ "pollIntervalMs": {
3204
+ "type": "integer",
3205
+ "minimum": 50,
3206
+ "maximum": 1000
3207
+ }
3208
+ },
3209
+ "required": [
3210
+ "id",
3211
+ "type",
3212
+ "selector"
3213
+ ]
3214
+ },
3215
+ {
3216
+ "type": "object",
3217
+ "additionalProperties": false,
3218
+ "properties": {
3219
+ "id": {
3220
+ "type": "string",
3221
+ "minLength": 1
3222
+ },
3223
+ "type": {
3224
+ "const": "assert"
3225
+ },
3226
+ "timeoutMs": {
3227
+ "type": "integer",
3228
+ "minimum": 100,
3229
+ "maximum": 60000
3230
+ },
3231
+ "pollIntervalMs": {
3232
+ "type": "integer",
3233
+ "minimum": 50,
3234
+ "maximum": 1000
3235
+ },
3236
+ "assertion": {
3237
+ "oneOf": [
3238
+ {
3239
+ "type": "object",
3240
+ "additionalProperties": false,
3241
+ "properties": {
3242
+ "kind": {
3243
+ "const": "element_visible"
3244
+ },
3245
+ "selector": {
3246
+ "type": "object",
3247
+ "additionalProperties": false,
3248
+ "properties": {
3249
+ "text": {
3250
+ "type": "string",
3251
+ "minLength": 1
3252
+ },
3253
+ "resource_id": {
3254
+ "type": "string",
3255
+ "minLength": 1
3256
+ },
3257
+ "accessibility_id": {
3258
+ "type": "string",
3259
+ "minLength": 1
3260
+ },
3261
+ "contains": {
3262
+ "type": "boolean"
3263
+ }
3264
+ },
3265
+ "anyOf": [
3266
+ {
3267
+ "required": [
3268
+ "text"
3269
+ ]
3270
+ },
3271
+ {
3272
+ "required": [
3273
+ "resource_id"
3274
+ ]
3275
+ },
3276
+ {
3277
+ "required": [
3278
+ "accessibility_id"
3279
+ ]
3280
+ }
3281
+ ]
3282
+ }
3283
+ },
3284
+ "required": [
3285
+ "kind",
3286
+ "selector"
3287
+ ]
3288
+ },
3289
+ {
3290
+ "type": "object",
3291
+ "additionalProperties": false,
3292
+ "properties": {
3293
+ "kind": {
3294
+ "const": "element_absent"
3295
+ },
3296
+ "selector": {
3297
+ "type": "object",
3298
+ "additionalProperties": false,
3299
+ "properties": {
3300
+ "text": {
3301
+ "type": "string",
3302
+ "minLength": 1
3303
+ },
3304
+ "resource_id": {
3305
+ "type": "string",
3306
+ "minLength": 1
3307
+ },
3308
+ "accessibility_id": {
3309
+ "type": "string",
3310
+ "minLength": 1
3311
+ },
3312
+ "contains": {
3313
+ "type": "boolean"
3314
+ }
3315
+ },
3316
+ "anyOf": [
3317
+ {
3318
+ "required": [
3319
+ "text"
3320
+ ]
3321
+ },
3322
+ {
3323
+ "required": [
3324
+ "resource_id"
3325
+ ]
3326
+ },
3327
+ {
3328
+ "required": [
3329
+ "accessibility_id"
3330
+ ]
3331
+ }
3332
+ ]
3333
+ }
3334
+ },
3335
+ "required": [
3336
+ "kind",
3337
+ "selector"
3338
+ ]
3339
+ },
3340
+ {
3341
+ "type": "object",
3342
+ "additionalProperties": false,
3343
+ "properties": {
3344
+ "kind": {
3345
+ "const": "screen_fingerprint"
3346
+ },
3347
+ "fingerprint": {
3348
+ "type": "string",
3349
+ "minLength": 1
3350
+ }
3351
+ },
3352
+ "required": [
3353
+ "kind",
3354
+ "fingerprint"
3355
+ ]
3356
+ },
3357
+ {
3358
+ "type": "object",
3359
+ "additionalProperties": false,
3360
+ "properties": {
3361
+ "kind": {
3362
+ "const": "state_equals"
3363
+ },
3364
+ "selector": {
3365
+ "type": "object",
3366
+ "additionalProperties": false,
3367
+ "properties": {
3368
+ "text": {
3369
+ "type": "string",
3370
+ "minLength": 1
3371
+ },
3372
+ "resource_id": {
3373
+ "type": "string",
3374
+ "minLength": 1
3375
+ },
3376
+ "accessibility_id": {
3377
+ "type": "string",
3378
+ "minLength": 1
3379
+ },
3380
+ "contains": {
3381
+ "type": "boolean"
3382
+ }
3383
+ },
3384
+ "anyOf": [
3385
+ {
3386
+ "required": [
3387
+ "text"
3388
+ ]
3389
+ },
3390
+ {
3391
+ "required": [
3392
+ "resource_id"
3393
+ ]
3394
+ },
3395
+ {
3396
+ "required": [
3397
+ "accessibility_id"
3398
+ ]
3399
+ }
3400
+ ]
3401
+ },
3402
+ "elementId": {
3403
+ "type": "string",
3404
+ "minLength": 1
3405
+ },
3406
+ "property": {
3407
+ "type": "string",
3408
+ "minLength": 1
3409
+ },
3410
+ "expected": {
3411
+ "type": [
3412
+ "boolean",
3413
+ "number",
3414
+ "string"
3415
+ ]
3416
+ }
3417
+ },
3418
+ "required": [
3419
+ "kind",
3420
+ "property",
3421
+ "expected"
3422
+ ],
3423
+ "oneOf": [
3424
+ {
3425
+ "required": [
3426
+ "selector"
3427
+ ],
3428
+ "not": {
3429
+ "required": [
3430
+ "elementId"
3431
+ ]
3432
+ }
3433
+ },
3434
+ {
3435
+ "required": [
3436
+ "elementId"
3437
+ ],
3438
+ "not": {
3439
+ "required": [
3440
+ "selector"
3441
+ ]
3442
+ }
3443
+ }
3444
+ ]
3445
+ }
3446
+ ]
3447
+ }
3448
+ },
3449
+ "required": [
3450
+ "id",
3451
+ "type",
3452
+ "assertion"
3453
+ ]
3454
+ }
3455
+ ]
3456
+ }
3457
+ },
3458
+ "systemTraceId": {
3459
+ "type": "string",
3460
+ "format": "uuid",
3461
+ "description": "Explicit active same-device system trace. Invalid references prevent all journey input. Capture lifetime is controlled separately."
3462
+ },
3463
+ "captureOnFailure": {
3464
+ "type": "boolean",
3465
+ "default": false
3466
+ },
3467
+ "defaults": {
3468
+ "type": "object",
3469
+ "additionalProperties": false,
3470
+ "properties": {
3471
+ "verificationMode": {
3472
+ "type": "string",
3473
+ "enum": [
3474
+ "none",
3475
+ "light",
3476
+ "full"
3477
+ ]
3478
+ },
3479
+ "actionTimeoutMs": {
3480
+ "type": "integer"
3481
+ },
3482
+ "verificationTimeoutMs": {
3483
+ "type": "integer"
3484
+ }
3485
+ }
3486
+ }
3487
+ },
3488
+ "required": [
3489
+ "platform",
3490
+ "steps"
3491
+ ],
3492
+ "allOf": [
3493
+ {
3494
+ "not": {
3495
+ "required": [
3496
+ "expectedState"
3497
+ ]
3498
+ }
3499
+ }
3500
+ ]
3501
+ }
3502
+ },
3503
+ {
3504
+ "name": "get_network_activity",
3505
+ "description": "Returns structured network events captured from platform logs since the last action.\n\nCall this immediately after an action when you want backend evidence for a side-effect flow, only if the result is still ambiguous.\nDo not call more than once per action.\n\nEvents are filtered to significant (non-background) requests only.\nEach event includes endpoint, method, statusCode, networkError, status, and durationMs.\n\nstatus values:\n- success: HTTP 2xx or request detected with no error signal\n- failure: HTTP 4xx\n- retryable: HTTP 5xx, network error (timeout, dns_error, tls_error, etc.)\n\nReturns { requests: [], count: 0 } when no credible network signals are found.",
3506
+ "inputSchema": {
3507
+ "type": "object",
3508
+ "properties": {
3509
+ "platform": {
3510
+ "type": "string",
3511
+ "enum": [
3512
+ "android",
3513
+ "ios"
3514
+ ],
3515
+ "description": "Platform to read network logs from"
3516
+ },
3517
+ "deviceId": {
3518
+ "type": "string",
3519
+ "description": "Device Serial (Android) or UDID (iOS). Defaults to connected/booted device."
3520
+ }
3521
+ },
3522
+ "required": [
3523
+ "platform"
3524
+ ],
3525
+ "allOf": [
3526
+ {
3527
+ "not": {
3528
+ "required": [
3529
+ "expectedState"
3530
+ ]
3531
+ }
3532
+ }
3533
+ ]
3534
+ }
3535
+ }
3536
+ ]