mobile-debug-mcp 0.34.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 (432) 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 +4 -4
  12. package/AGENTS.md +12 -3
  13. package/CONTRIBUTING.md +79 -0
  14. package/README.md +156 -129
  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 +16 -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 +27 -2
  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 +2 -1
  28. package/dist/debugger/diagnostics.js +54 -0
  29. package/dist/debugger/protocol.js +33 -0
  30. package/dist/debugger/sessions.js +104 -62
  31. package/dist/debugger/worker.js +53 -42
  32. package/dist/interact/adjustment/adjustment-context.js +41 -0
  33. package/dist/interact/adjustment/adjustment-gestures.js +55 -0
  34. package/dist/interact/adjustment/adjustment-plan.js +18 -0
  35. package/dist/interact/adjustment/adjustment-resolution.js +127 -0
  36. package/dist/interact/adjustment/adjustment-result.js +19 -0
  37. package/dist/interact/adjustment/adjustment-semantic.js +64 -0
  38. package/dist/interact/adjustment/adjustment-verification.js +35 -0
  39. package/dist/interact/adjustment/adjustment.js +52 -0
  40. package/dist/interact/adjustment/control-geometry.js +87 -0
  41. package/dist/interact/adjustment/control-values.js +136 -0
  42. package/dist/interact/adjustment/slider-labels.js +84 -0
  43. package/dist/interact/assertions/screen-assertion.js +37 -0
  44. package/dist/interact/assertions/state-assertion-context.js +35 -0
  45. package/dist/interact/assertions/state-assertion.js +76 -0
  46. package/dist/interact/assertions/state-comparison.js +141 -0
  47. package/dist/interact/assertions/visibility-assertion.js +34 -0
  48. package/dist/interact/conditional-action.js +12 -7
  49. package/dist/interact/index.js +65 -3090
  50. package/dist/interact/input-service.js +1 -0
  51. package/dist/interact/interaction-trace.js +21 -0
  52. package/dist/interact/model.js +1 -0
  53. package/dist/interact/observation.js +1 -0
  54. package/dist/interact/targeting/candidate-ancestor.js +58 -0
  55. package/dist/interact/targeting/candidate-result.js +23 -0
  56. package/dist/interact/targeting/candidate-scoring.js +50 -0
  57. package/dist/interact/targeting/element-helpers.js +216 -0
  58. package/dist/interact/targeting/find-element.js +65 -0
  59. package/dist/interact/targeting/nearby-control.js +56 -0
  60. package/dist/interact/targeting/resolved-elements.js +21 -0
  61. package/dist/interact/targeting/tap-target.js +17 -0
  62. package/dist/interact/targeting/target-scope.js +104 -0
  63. package/dist/interact/waits/legacy-log-wait.js +38 -0
  64. package/dist/interact/waits/legacy-wait-observations.js +103 -0
  65. package/dist/interact/waits/legacy-wait-state.js +34 -0
  66. package/dist/interact/waits/legacy-wait.js +48 -0
  67. package/dist/interact/waits/screen-wait.js +49 -0
  68. package/dist/interact/waits/ui-change-helpers.js +157 -0
  69. package/dist/interact/waits/ui-change-state.js +18 -0
  70. package/dist/interact/waits/ui-change-wait.js +77 -0
  71. package/dist/interact/waits/ui-wait-condition.js +56 -0
  72. package/dist/interact/waits/ui-wait-state.js +38 -0
  73. package/dist/interact/waits/ui-wait.js +106 -0
  74. package/dist/manage/android.js +55 -51
  75. package/dist/manage/index.js +38 -75
  76. package/dist/manage/ios/build-types.js +1 -0
  77. package/dist/manage/ios/build.js +210 -0
  78. package/dist/manage/ios/project-discovery.js +29 -0
  79. package/dist/manage/ios/scheme.js +18 -0
  80. package/dist/manage/ios.js +42 -256
  81. package/dist/observe/android/context.js +1 -0
  82. package/dist/observe/android/current-screen.js +55 -0
  83. package/dist/observe/android/fingerprint.js +13 -0
  84. package/dist/observe/android/log-stream.js +132 -0
  85. package/dist/observe/android/logs.js +107 -0
  86. package/dist/observe/android/screenshot.js +70 -0
  87. package/dist/observe/android/ui-tree.js +107 -0
  88. package/dist/observe/android.js +16 -520
  89. package/dist/observe/evidence.js +114 -75
  90. package/dist/observe/index.js +16 -263
  91. package/dist/observe/ios/context.js +16 -0
  92. package/dist/observe/ios/fingerprint.js +12 -0
  93. package/dist/observe/ios/log-stream.js +105 -0
  94. package/dist/observe/ios/logs.js +168 -0
  95. package/dist/observe/ios/screenshot.js +22 -0
  96. package/dist/observe/ios/ui-elements.js +241 -0
  97. package/dist/observe/ios/ui-tree.js +137 -0
  98. package/dist/observe/ios.js +17 -715
  99. package/dist/observe/logs/model.js +1 -0
  100. package/dist/{network → observe/network}/index.js +2 -2
  101. package/dist/observe/readiness-service.js +4 -2
  102. package/dist/observe/readiness.js +29 -10
  103. package/dist/observe/screenshot-encoding.js +41 -0
  104. package/dist/observe/snapshot-collection.js +79 -0
  105. package/dist/observe/snapshot-logs.js +30 -0
  106. package/dist/observe/snapshot-metadata.js +43 -31
  107. package/dist/observe/snapshot-semantic.js +115 -0
  108. package/dist/observe/system-trace.js +22 -13
  109. package/dist/runtime/action-results.js +270 -0
  110. package/dist/runtime/clock.js +4 -0
  111. package/dist/server/common.js +1 -256
  112. package/dist/server/definitions/assert.js +162 -0
  113. package/dist/server/definitions/diagnostic.js +118 -0
  114. package/dist/server/definitions/input.js +274 -0
  115. package/dist/server/definitions/manage.js +194 -0
  116. package/dist/server/definitions/observe.js +149 -0
  117. package/dist/server/definitions/target.js +138 -0
  118. package/dist/server/definitions/wait.js +105 -0
  119. package/dist/server/handlers/action-execution.js +163 -0
  120. package/dist/server/handlers/correlation.js +23 -0
  121. package/dist/server/{debugger-handlers.js → handlers/debugger-handlers.js} +22 -12
  122. package/dist/server/handlers/debugger-response.js +9 -0
  123. package/dist/server/handlers/diagnostic.js +69 -0
  124. package/dist/server/handlers/handler-types.js +1 -0
  125. package/dist/server/handlers/input.js +154 -0
  126. package/dist/server/handlers/interact.js +113 -0
  127. package/dist/server/handlers/journey-assertions.js +35 -0
  128. package/dist/server/handlers/journey.js +147 -0
  129. package/dist/server/handlers/manage.js +119 -0
  130. package/dist/server/handlers/observe.js +95 -0
  131. package/dist/server/handlers/payload.js +4 -0
  132. package/dist/server/handlers/tool-handlers.js +160 -0
  133. package/dist/server/schemas/condition-schema.js +2 -0
  134. package/dist/server/{debugger-schema.js → schemas/debugger-schema.js} +11 -6
  135. package/dist/server/{journey-schema.js → schemas/journey-schema.js} +7 -22
  136. package/dist/server/tool-definitions.js +58 -1135
  137. package/dist/server-core.js +2 -2
  138. package/dist/system/android-status.js +101 -0
  139. package/dist/system/android.js +37 -27
  140. package/dist/system/index.js +13 -439
  141. package/dist/system/ios-status.js +132 -0
  142. package/dist/system/ios.js +11 -8
  143. package/dist/system/model.js +1 -0
  144. package/dist/system/probes.js +105 -0
  145. package/dist/system/status-summary.js +43 -0
  146. package/dist/system/unsupported-status.js +52 -0
  147. package/dist/utils/android/commands.js +89 -0
  148. package/dist/utils/android/gradle.js +139 -0
  149. package/dist/utils/android/logs.js +103 -0
  150. package/dist/utils/android/ui-tree.js +233 -0
  151. package/dist/utils/android/utils.js +6 -564
  152. package/dist/utils/cli/idb/idb-helper.js +4 -6
  153. package/dist/utils/cli/idb/install-idb.js +13 -9
  154. package/dist/utils/cli/ios/preflight-ios.js +42 -38
  155. package/dist/utils/ios/utils.js +45 -46
  156. package/dist/utils/java.js +65 -49
  157. package/dist/utils/resolve-device.js +4 -2
  158. package/dist/utils/ui/index.js +26 -26
  159. package/docs/CHANGELOG.md +44 -0
  160. package/docs/README.md +38 -0
  161. package/docs/benchmarks/README.md +18 -0
  162. package/docs/benchmarks/interaction-latency/README.md +14 -0
  163. package/docs/benchmarks/interaction-latency/final.md +4 -1
  164. package/docs/benchmarks/interaction-latency/ios-validation.md +2 -0
  165. package/docs/benchmarks/ui-tree-performance/README.md +24 -16
  166. package/docs/benchmarks/ui-tree-performance/comparison.md +11 -10
  167. package/docs/code-structure.md +118 -0
  168. package/docs/specs/001-state-verification/spec.md +16 -14
  169. package/docs/specs/002-richer-element-identity/spec.md +12 -10
  170. package/docs/specs/003-wait-and-synchronization-reliability/spec.md +12 -10
  171. package/docs/specs/004-action-verification-routing/spec.md +3 -3
  172. package/docs/specs/005-unified-action-execution-and-verification-model/spec.md +2 -0
  173. package/docs/specs/006-runtime-action-instrumentation-and-binding-layer/spec.md +2 -0
  174. package/docs/specs/007-actionability-resolution-and-executable-target-selection/spec.md +3 -1
  175. package/docs/specs/008-adjustable-control-support-and-semantic-value-manipulation/spec.md +3 -4
  176. package/docs/specs/009-semantic-control-modeling-for-custom-and-composite-controls/spec.md +2 -0
  177. package/docs/specs/010-verification-stabilization-and-temporal-convergence/spec.md +2 -2
  178. package/docs/specs/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows/spec.md +2 -2
  179. package/docs/specs/011.1-recovery-contract-types-and-runtime-wiring-spec/spec.md +2 -0
  180. package/docs/specs/012-action-trace-and-xecution-observability/spec.md +2 -3
  181. package/docs/specs/013-wait-and-synchronization-reliability/spec.md +19 -19
  182. package/docs/specs/014-actionability-resolution/spec.md +20 -18
  183. package/docs/specs/015-adjustable-control-support/spec.md +17 -15
  184. package/docs/specs/016-environment-tools/spec.md +20 -20
  185. package/docs/specs/018-interaction-latency-and-batched-journeys/spec.md +2 -0
  186. package/docs/specs/019-ui-tree-observation-performance/spec.md +3 -1
  187. package/docs/specs/020-conditional-actions/intent.md +5 -3
  188. package/docs/specs/020-conditional-actions/plan.md +8 -9
  189. package/docs/specs/020-conditional-actions/spec.md +4 -2
  190. package/docs/specs/021-app-readiness-signals/intent.md +4 -2
  191. package/docs/specs/021-app-readiness-signals/plan.md +7 -6
  192. package/docs/specs/021-app-readiness-signals/spec.md +3 -1
  193. package/docs/specs/022-correlated-evidence/intent.md +4 -4
  194. package/docs/specs/022-correlated-evidence/plan.md +10 -11
  195. package/docs/specs/022-correlated-evidence/spec.md +3 -1
  196. package/docs/specs/023-android-system-traces/intent.md +3 -2
  197. package/docs/specs/023-android-system-traces/plan.md +5 -7
  198. package/docs/specs/023-android-system-traces/spec.md +3 -1
  199. package/docs/specs/024-android-heap-dump-capture/intent.md +3 -1
  200. package/docs/specs/025-android-runtime-debugger/intent.md +4 -3
  201. package/docs/specs/025-android-runtime-debugger/plan.md +3 -1
  202. package/docs/specs/025-android-runtime-debugger/spec.md +4 -3
  203. package/docs/specs/026-code-structure-and-quality-gates/health-plan.md +88 -0
  204. package/docs/specs/026-code-structure-and-quality-gates/intent.md +47 -0
  205. package/docs/specs/026-code-structure-and-quality-gates/plan.md +191 -0
  206. package/docs/specs/026-code-structure-and-quality-gates/spec.md +138 -0
  207. package/docs/specs/026-code-structure-and-quality-gates/verification-final.json +200 -0
  208. package/docs/specs/026-code-structure-and-quality-gates/verification-thin-facade.json +154 -0
  209. package/docs/specs/026-code-structure-and-quality-gates/verification.json +136 -0
  210. package/docs/specs/027-debugger-failure-diagnostics/intent.md +43 -0
  211. package/docs/specs/027-debugger-failure-diagnostics/plan.md +86 -0
  212. package/docs/specs/027-debugger-failure-diagnostics/spec.md +133 -0
  213. package/docs/specs/028-compact-debugger-responses/intent.md +41 -0
  214. package/docs/specs/028-compact-debugger-responses/plan.md +112 -0
  215. package/docs/specs/028-compact-debugger-responses/spec.md +108 -0
  216. package/docs/specs/029-kotlin-locals-validation/report.md +119 -0
  217. package/docs/specs/030-android-coroutine-validation/evidence.json +475 -0
  218. package/docs/specs/030-android-coroutine-validation/intent.md +47 -0
  219. package/docs/specs/030-android-coroutine-validation/plan.md +147 -0
  220. package/docs/specs/030-android-coroutine-validation/report.md +240 -0
  221. package/docs/specs/030-android-coroutine-validation/spec.md +107 -0
  222. package/docs/tools/TOOLS.md +31 -18
  223. package/docs/tools/{evidence.md → correlated-evidence.md} +9 -1
  224. package/docs/tools/debugger.md +76 -0
  225. package/docs/tools/interact.md +42 -20
  226. package/docs/tools/manage.md +25 -44
  227. package/docs/tools/observe.md +55 -23
  228. package/docs/tools/system-traces.md +9 -1
  229. package/docs/tools/system.md +12 -5
  230. package/package.json +11 -8
  231. package/scripts/architecture-graph.mjs +69 -0
  232. package/scripts/check-architecture.mjs +47 -0
  233. package/scripts/code-quality-baseline.json +1 -0
  234. package/scripts/code-quality.mjs +161 -0
  235. package/src/contracts/execution-controls.ts +26 -0
  236. package/src/contracts/selector.ts +17 -0
  237. package/src/contracts/target.ts +19 -0
  238. package/src/contracts/ui.ts +94 -0
  239. package/src/debugger/android.ts +2 -1
  240. package/src/debugger/diagnostics.ts +43 -0
  241. package/src/debugger/guard.ts +6 -1
  242. package/{worker → src/debugger/java}/DebuggerWorker.java +9 -3
  243. package/src/debugger/protocol.ts +37 -0
  244. package/src/debugger/sessions.ts +314 -155
  245. package/src/debugger/worker.ts +51 -38
  246. package/src/interact/adjustment/adjustment-context.ts +83 -0
  247. package/src/interact/adjustment/adjustment-gestures.ts +48 -0
  248. package/src/interact/adjustment/adjustment-plan.ts +23 -0
  249. package/src/interact/adjustment/adjustment-resolution.ts +104 -0
  250. package/src/interact/adjustment/adjustment-result.ts +34 -0
  251. package/src/interact/adjustment/adjustment-semantic.ts +53 -0
  252. package/src/interact/adjustment/adjustment-verification.ts +60 -0
  253. package/src/interact/adjustment/adjustment.ts +49 -0
  254. package/src/interact/adjustment/control-geometry.ts +120 -0
  255. package/src/interact/adjustment/control-values.ts +141 -0
  256. package/src/interact/adjustment/slider-labels.ts +84 -0
  257. package/src/interact/assertions/screen-assertion.ts +39 -0
  258. package/src/interact/assertions/state-assertion-context.ts +48 -0
  259. package/src/interact/assertions/state-assertion.ts +64 -0
  260. package/src/interact/assertions/state-comparison.ts +168 -0
  261. package/src/interact/assertions/visibility-assertion.ts +41 -0
  262. package/src/interact/conditional-action.ts +18 -12
  263. package/src/interact/index.ts +76 -3492
  264. package/src/interact/input-service.ts +11 -0
  265. package/src/interact/interaction-trace.ts +36 -0
  266. package/src/interact/model.ts +109 -0
  267. package/src/interact/observation.ts +7 -0
  268. package/src/interact/targeting/candidate-ancestor.ts +49 -0
  269. package/src/interact/targeting/candidate-result.ts +24 -0
  270. package/src/interact/targeting/candidate-scoring.ts +42 -0
  271. package/src/interact/targeting/element-helpers.ts +243 -0
  272. package/src/interact/targeting/find-element.ts +47 -0
  273. package/src/interact/targeting/nearby-control.ts +46 -0
  274. package/src/interact/targeting/resolved-elements.ts +20 -0
  275. package/src/interact/targeting/tap-target.ts +22 -0
  276. package/src/interact/targeting/target-scope.ts +121 -0
  277. package/src/interact/waits/legacy-log-wait.ts +30 -0
  278. package/src/interact/waits/legacy-wait-observations.ts +55 -0
  279. package/src/interact/waits/legacy-wait-state.ts +48 -0
  280. package/src/interact/waits/legacy-wait.ts +34 -0
  281. package/src/interact/waits/screen-wait.ts +37 -0
  282. package/src/interact/waits/ui-change-helpers.ts +184 -0
  283. package/src/interact/waits/ui-change-state.ts +26 -0
  284. package/src/interact/waits/ui-change-wait.ts +59 -0
  285. package/src/interact/waits/ui-wait-condition.ts +52 -0
  286. package/src/interact/waits/ui-wait-state.ts +55 -0
  287. package/src/interact/waits/ui-wait.ts +84 -0
  288. package/src/manage/android.ts +56 -50
  289. package/src/manage/index.ts +63 -93
  290. package/src/manage/ios/build-types.ts +14 -0
  291. package/src/manage/ios/build.ts +230 -0
  292. package/src/manage/ios/project-discovery.ts +26 -0
  293. package/src/manage/ios/scheme.ts +16 -0
  294. package/src/manage/ios.ts +65 -298
  295. package/src/observe/android/context.ts +1 -0
  296. package/src/observe/android/current-screen.ts +63 -0
  297. package/src/observe/android/fingerprint.ts +13 -0
  298. package/src/observe/android/log-stream.ts +127 -0
  299. package/src/observe/android/logs.ts +110 -0
  300. package/src/observe/android/screenshot.ts +79 -0
  301. package/src/observe/android/ui-tree.ts +113 -0
  302. package/src/observe/android.ts +17 -531
  303. package/src/observe/evidence.ts +122 -70
  304. package/src/observe/index.ts +24 -286
  305. package/src/observe/ios/context.ts +22 -0
  306. package/src/observe/ios/fingerprint.ts +12 -0
  307. package/src/observe/ios/log-stream.ts +103 -0
  308. package/src/observe/ios/logs.ts +179 -0
  309. package/src/observe/ios/screenshot.ts +26 -0
  310. package/src/observe/ios/ui-elements.ts +266 -0
  311. package/src/observe/ios/ui-tree.ts +143 -0
  312. package/src/observe/ios.ts +18 -749
  313. package/src/observe/logs/model.ts +11 -0
  314. package/src/{network → observe/network}/index.ts +2 -2
  315. package/src/observe/readiness-service.ts +5 -3
  316. package/src/observe/readiness.ts +39 -18
  317. package/src/observe/screenshot-encoding.ts +32 -0
  318. package/src/observe/snapshot-collection.ts +69 -0
  319. package/src/observe/snapshot-logs.ts +26 -0
  320. package/src/observe/snapshot-metadata.ts +51 -31
  321. package/src/observe/snapshot-semantic.ts +153 -0
  322. package/src/observe/system-trace.ts +24 -15
  323. package/src/runtime/action-results.ts +376 -0
  324. package/src/runtime/clock.ts +9 -0
  325. package/src/server/common.ts +9 -359
  326. package/src/server/definitions/assert.ts +164 -0
  327. package/src/server/definitions/diagnostic.ts +120 -0
  328. package/src/server/definitions/input.ts +276 -0
  329. package/src/server/definitions/manage.ts +196 -0
  330. package/src/server/definitions/observe.ts +151 -0
  331. package/src/server/definitions/target.ts +140 -0
  332. package/src/server/definitions/wait.ts +107 -0
  333. package/src/server/handlers/action-execution.ts +164 -0
  334. package/src/server/handlers/correlation.ts +20 -0
  335. package/src/server/handlers/debugger-handlers.ts +39 -0
  336. package/src/server/handlers/debugger-response.ts +7 -0
  337. package/src/server/handlers/diagnostic.ts +79 -0
  338. package/src/server/handlers/handler-types.ts +7 -0
  339. package/src/server/handlers/input.ts +173 -0
  340. package/src/server/handlers/interact.ts +135 -0
  341. package/src/server/handlers/journey-assertions.ts +39 -0
  342. package/src/server/handlers/journey.ts +132 -0
  343. package/src/server/handlers/manage.ts +141 -0
  344. package/src/server/handlers/observe.ts +116 -0
  345. package/src/server/handlers/payload.ts +36 -0
  346. package/src/server/handlers/tool-handlers.ts +159 -0
  347. package/src/server/schemas/condition-schema.ts +2 -0
  348. package/src/server/{debugger-schema.ts → schemas/debugger-schema.ts} +13 -7
  349. package/src/server/{journey-schema.ts → schemas/journey-schema.ts} +7 -22
  350. package/src/server/{system-trace-schema.ts → schemas/system-trace-schema.ts} +3 -3
  351. package/src/server/tool-definitions.ts +67 -1143
  352. package/src/server-core.ts +2 -2
  353. package/src/server.ts +1 -1
  354. package/src/system/android-status.ts +124 -0
  355. package/src/system/android.ts +33 -21
  356. package/src/system/index.ts +21 -525
  357. package/src/system/ios-status.ts +147 -0
  358. package/src/system/ios.ts +14 -10
  359. package/src/system/model.ts +41 -0
  360. package/src/system/probes.ts +114 -0
  361. package/src/system/status-summary.ts +47 -0
  362. package/src/system/unsupported-status.ts +55 -0
  363. package/src/types.ts +16 -106
  364. package/src/utils/android/commands.ts +81 -0
  365. package/src/utils/android/gradle.ts +132 -0
  366. package/src/utils/android/logs.ts +103 -0
  367. package/src/utils/android/ui-tree.ts +239 -0
  368. package/src/utils/android/utils.ts +16 -556
  369. package/src/utils/cli/idb/check-idb.ts +4 -4
  370. package/src/utils/cli/idb/idb-helper.ts +6 -8
  371. package/src/utils/cli/idb/install-idb.ts +15 -9
  372. package/src/utils/cli/ios/preflight-ios.ts +39 -31
  373. package/src/utils/cli/ios/run-ios-ui-tree-tap.ts +4 -4
  374. package/src/utils/ios/utils.ts +57 -61
  375. package/src/utils/java.ts +62 -43
  376. package/src/utils/resolve-device.ts +9 -6
  377. package/src/utils/ui/index.ts +28 -28
  378. package/test/device/automated/debugger/coroutine-lifecycle.ts +27 -0
  379. package/test/device/automated/debugger/coroutine-support.ts +140 -0
  380. package/test/device/automated/debugger/coroutine.android.test.ts +169 -0
  381. package/test/device/automated/debugger/kotlin.android.test.ts +127 -0
  382. package/test/device/automated/debugger/runtime.android.test.ts +19 -3
  383. package/test/device/automated/interact/interaction.android.test.ts +56 -0
  384. package/test/device/automated/observe/system-trace.smoke.ts +1 -1
  385. package/test/device/manual/interact/modul8_selector_tap.manual.ts +1 -1
  386. package/test/fixtures/contracts/tool-definitions.json +3536 -0
  387. package/test/fixtures/coroutine-app/MainActivity.kt +100 -0
  388. package/test/fixtures/coroutine-app/README.md +48 -0
  389. package/test/fixtures/coroutine-app/build.ts +35 -0
  390. package/test/fixtures/debugger-app/MainActivity.java +21 -0
  391. package/test/fixtures/debugger-app/MainActivity.kt +32 -0
  392. package/test/fixtures/debugger-app/README.md +52 -0
  393. package/test/fixtures/debugger-app/build.ts +25 -15
  394. package/test/fixtures/latency-journey-app/README.md +2 -0
  395. package/test/fixtures/readiness-app/README.md +2 -0
  396. package/test/unit/debugger/coroutine-lifecycle.test.ts +43 -0
  397. package/test/unit/debugger/diagnostic-sessions.test.ts +67 -0
  398. package/test/unit/debugger/diagnostics.test.ts +80 -0
  399. package/test/unit/debugger/guards.test.ts +4 -0
  400. package/test/unit/debugger/preparation.test.ts +32 -0
  401. package/test/unit/debugger/protocol.test.ts +15 -0
  402. package/test/unit/debugger/sessions.test.ts +1 -1
  403. package/test/unit/interact/adjustment_service.test.ts +42 -0
  404. package/test/unit/interact/adjustment_verification.test.ts +35 -0
  405. package/test/unit/interact/clock_dependencies.test.ts +63 -0
  406. package/test/unit/interact/element_helpers.test.ts +19 -0
  407. package/test/unit/interact/legacy_wait_service.test.ts +17 -0
  408. package/test/unit/interact/state_comparison.test.ts +20 -0
  409. package/test/unit/interact/target_scope.test.ts +35 -0
  410. package/test/unit/network/get_network_activity.test.ts +1 -1
  411. package/test/unit/observe/screenshot-encoding.test.ts +30 -0
  412. package/test/unit/observe/snapshot-logs.test.ts +14 -0
  413. package/test/unit/quality/architecture.test.ts +60 -0
  414. package/test/unit/quality/code-quality.test.ts +58 -0
  415. package/test/unit/quality/interaction_boundaries.test.ts +24 -0
  416. package/test/unit/server/conditional_actions.test.ts +1 -1
  417. package/test/unit/server/conditional_schema.test.ts +2 -2
  418. package/test/unit/server/debugger-response.test.ts +63 -0
  419. package/test/unit/server/tool_definitions_parity.test.ts +8 -0
  420. package/dist/server/tool-handlers.js +0 -1000
  421. package/docs/ROADMAP.md +0 -646
  422. package/docs/benchmarks/ui-tree-performance/bridge-probe.json +0 -29
  423. package/docs/benchmarks/ui-tree-performance/initial-baseline.json +0 -59560
  424. package/docs/specs/baseline-spec-v0.md +0 -312
  425. package/docs/specs/mcp-tooling-spec-v1.md +0 -446
  426. package/src/server/debugger-handlers.ts +0 -29
  427. package/src/server/tool-handlers.ts +0 -1008
  428. /package/dist/{server/condition-schema.js → contracts/condition.js} +0 -0
  429. /package/dist/server/{readiness-schema.js → schemas/readiness-schema.js} +0 -0
  430. /package/dist/server/{system-trace-schema.js → schemas/system-trace-schema.js} +0 -0
  431. /package/src/{server/condition-schema.ts → contracts/condition.ts} +0 -0
  432. /package/src/server/{readiness-schema.ts → schemas/readiness-schema.ts} +0 -0
@@ -0,0 +1,276 @@
1
+ import { verificationModeJson, responseModeJson } from '../../contracts/execution-controls.js'
2
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js'
3
+
4
+ export const inputTools: Tool[] = [
5
+ {
6
+ name: 'tap',
7
+ description: `Purpose:
8
+ Dispatch a tap at specific screen coordinates.
9
+
10
+ Inputs:
11
+ - x, y coordinates
12
+ - platform (optional)
13
+ - deviceId (optional)
14
+
15
+ Output Structure:
16
+ - action_id, timestamp (ISO 8601), action_type
17
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
18
+ - source_module: runtime source of the action envelope
19
+ - target.selector = { x, y }
20
+ - success = true when the tap was dispatched
21
+ - failure_code/retryable when dispatch fails
22
+ - ui_fingerprint_before/ui_fingerprint_after when available
23
+
24
+ Recommended Usage:
25
+ 1. Resolve coordinates deterministically
26
+ 2. Call tap
27
+ 3. If needed, wait for transition using wait_for_*
28
+ 4. Verify with expect_screen or expect_element_visible depending on the intended outcome
29
+
30
+ Verification Guidance:
31
+ - Prefer tap_element over tap when an element can be resolved
32
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
33
+ - Use expect_screen for navigation and expect_element_visible for local UI changes
34
+ - Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
35
+
36
+ Failure Handling:
37
+ - TIMEOUT → retry once
38
+ - UNKNOWN → capture a snapshot and stop`,
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {
42
+ platform: {
43
+ type: 'string',
44
+ enum: ['android', 'ios'],
45
+ description: 'Platform to tap on'
46
+ },
47
+ x: {
48
+ type: 'number',
49
+ description: 'X coordinate'
50
+ },
51
+ y: {
52
+ type: 'number',
53
+ description: 'Y coordinate'
54
+ },
55
+ deviceId: {
56
+ type: 'string',
57
+ description: 'Device Serial/UDID. Defaults to connected/booted device.'
58
+ },
59
+ verificationMode: { ...verificationModeJson, default: 'full' },
60
+ responseMode: { ...responseModeJson, default: 'debug' },
61
+ actionTimeoutMs: { type: 'number', minimum: 100, maximum: 30000 },
62
+ verificationTimeoutMs: { type: 'number', minimum: 100, maximum: 60000 }
63
+ },
64
+ required: ['x', 'y']
65
+ }
66
+ },
67
+ {
68
+ name: 'swipe',
69
+ description: `Purpose:
70
+ Dispatch a swipe gesture on Android or iOS.
71
+
72
+ Inputs:
73
+ - start and end coordinates
74
+ - duration
75
+ - platform/deviceId (optional)
76
+
77
+ Output Structure:
78
+ - action_id, timestamp (ISO 8601), action_type
79
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
80
+ - source_module: runtime source of the action envelope
81
+ - target.selector = { x1, y1, x2, y2, duration }
82
+ - success = true when the swipe was dispatched
83
+ - failure_code/retryable when dispatch fails
84
+ - ui_fingerprint_before/ui_fingerprint_after when available
85
+
86
+ Recommended Usage:
87
+ 1. Determine swipe coordinates
88
+ 2. Call swipe
89
+ 3. If needed, wait for transition using wait_for_*
90
+ 4. Verify with expect_screen or expect_element_visible when a deterministic outcome is expected
91
+
92
+ Verification Guidance:
93
+ - Swipe outcomes are less predictable; choose the most specific verifier available for the intended effect
94
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
95
+ - Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
96
+
97
+ Failure Handling:
98
+ - TIMEOUT → retry once
99
+ - UNKNOWN → capture a snapshot and stop`,
100
+ inputSchema: {
101
+ type: 'object',
102
+ properties: {
103
+ platform: {
104
+ type: 'string',
105
+ enum: ['android', 'ios'],
106
+ description: 'Platform to swipe on (android or ios)'
107
+ },
108
+ x1: { type: 'number', description: 'Start X coordinate' },
109
+ y1: { type: 'number', description: 'Start Y coordinate' },
110
+ x2: { type: 'number', description: 'End X coordinate' },
111
+ y2: { type: 'number', description: 'End Y coordinate' },
112
+ duration: { type: 'number', description: 'Duration in ms' },
113
+ deviceId: {
114
+ type: 'string',
115
+ description: 'Device Serial/UDID. Defaults to connected/booted device.'
116
+ }
117
+ },
118
+ required: ['x1', 'y1', 'x2', 'y2', 'duration']
119
+ }
120
+ },
121
+ {
122
+ name: 'scroll_to_element',
123
+ description: `Purpose:
124
+ Scroll until a target element becomes visible.
125
+
126
+ Inputs:
127
+ - platform
128
+ - selector
129
+ - direction, maxScrolls, scrollAmount, deviceId (optional)
130
+
131
+ Output Structure:
132
+ - action_id, timestamp (ISO 8601), action_type
133
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
134
+ - source_module: runtime source of the action envelope
135
+ - target.selector = original selector
136
+ - target.resolved = minimal resolved element info when found
137
+ - success = true when scrolling produced a visible target element
138
+ - failure_code/retryable when the target was not reached
139
+ - ui_fingerprint_before/ui_fingerprint_after when available
140
+
141
+ Recommended Usage:
142
+ 1. Resolve the target selector
143
+ 2. Call scroll_to_element
144
+ 3. If needed, wait for UI stabilization using wait_for_*
145
+ 4. Verify with expect_element_visible when the expected element visibility is known
146
+ 5. If success=false, follow failure handling before retrying
147
+
148
+ Verification Guidance:
149
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
150
+ - Use expect_element_visible when you need an explicit post-scroll confirmation
151
+ - Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
152
+
153
+ Failure Handling:
154
+ - NAVIGATION_NO_CHANGE → adjust scroll direction or stop
155
+ - TIMEOUT → retry with refined selector or larger scroll budget
156
+ - UNKNOWN → capture a snapshot and stop`,
157
+ inputSchema: {
158
+ type: 'object',
159
+ properties: {
160
+ platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to operate on (required)' },
161
+ selector: {
162
+ type: 'object',
163
+ properties: {
164
+ text: { type: 'string' },
165
+ resourceId: { type: 'string' },
166
+ contentDesc: { type: 'string' },
167
+ className: { type: 'string' }
168
+ }
169
+ },
170
+ direction: { type: 'string', enum: ['down', 'up'], default: 'down' },
171
+ maxScrolls: { type: 'number', default: 10 },
172
+ scrollAmount: { type: 'number', default: 0.7 },
173
+ deviceId: { type: 'string', description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.' }
174
+ },
175
+ required: ['platform', 'selector']
176
+ }
177
+ },
178
+ {
179
+ name: 'type_text',
180
+ description: `Purpose:
181
+ Type text into the currently focused Android input field.
182
+
183
+ Inputs:
184
+ - text
185
+ - platform/deviceId (optional)
186
+
187
+ Output Structure:
188
+ - action_id, timestamp (ISO 8601), action_type
189
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
190
+ - source_module: runtime source of the action envelope
191
+ - target.selector = { text }
192
+ - success = true when text input was dispatched
193
+ - failure_code/retryable when dispatch fails
194
+ - ui_fingerprint_before/ui_fingerprint_after when available
195
+
196
+ Recommended Usage:
197
+ 1. Resolve or focus the target input first
198
+ 2. Call type_text
199
+ 3. If needed, wait for UI stabilization using wait_for_*
200
+ 4. Verify with expect_element_visible or expect_screen, depending on the intended outcome
201
+
202
+ Verification Guidance:
203
+ - Prefer verifying the next expected element or screen state instead of inferring success from the text action alone
204
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
205
+ - Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
206
+
207
+ Failure Handling:
208
+ - TIMEOUT → retry once
209
+ - UNKNOWN → re-focus the input or capture a snapshot`,
210
+ inputSchema: {
211
+ type: 'object',
212
+ properties: {
213
+ platform: {
214
+ type: 'string',
215
+ enum: ['android'],
216
+ description: 'Platform to type on (currently only android supported)'
217
+ },
218
+ text: {
219
+ type: 'string',
220
+ description: 'The text to type'
221
+ },
222
+ deviceId: {
223
+ type: 'string',
224
+ description: 'Device Serial/UDID. Defaults to connected/booted device.'
225
+ }
226
+ },
227
+ required: ['text']
228
+ }
229
+ },
230
+ {
231
+ name: 'press_back',
232
+ description: `Purpose:
233
+ Dispatch the Android Back action.
234
+
235
+ Inputs:
236
+ - platform/deviceId (optional)
237
+
238
+ Output Structure:
239
+ - action_id, timestamp (ISO 8601), action_type
240
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
241
+ - source_module: runtime source of the action envelope
242
+ - target.selector = { key: "back" }
243
+ - success = true when the back action was dispatched
244
+ - failure_code/retryable when dispatch fails
245
+ - ui_fingerprint_before/ui_fingerprint_after when available
246
+
247
+ Recommended Usage:
248
+ 1. Call press_back
249
+ 2. If needed, wait for transition using wait_for_*
250
+ 3. Verify with expect_screen when a known destination is expected
251
+ 4. If verification fails, retry once or recover explicitly
252
+
253
+ Verification Guidance:
254
+ - Back outcomes can vary by screen, so verify against the intended destination when possible
255
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
256
+ - Do not use wait_for_* alone as final verification when an applicable expect_* tool exists
257
+
258
+ Failure Handling:
259
+ - TIMEOUT → retry once
260
+ - UNKNOWN → capture a snapshot and stop`,
261
+ inputSchema: {
262
+ type: 'object',
263
+ properties: {
264
+ platform: {
265
+ type: 'string',
266
+ enum: ['android'],
267
+ description: 'Platform (currently only android supported)'
268
+ },
269
+ deviceId: {
270
+ type: 'string',
271
+ description: 'Device Serial/UDID. Defaults to connected/booted device.'
272
+ }
273
+ }
274
+ }
275
+ }
276
+ ]
@@ -0,0 +1,196 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js'
2
+
3
+ export const manageTools: Tool[] = [
4
+ {
5
+ name: 'start_app',
6
+ description: `Purpose:
7
+ Launch a mobile app on Android or iOS.
8
+
9
+ Inputs:
10
+ - platform
11
+ - appId
12
+ - deviceId (optional)
13
+
14
+ Output Structure:
15
+ - action_id, timestamp (ISO 8601), action_type
16
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
17
+ - source_module: runtime source of the action envelope
18
+ - target.selector = { appId }
19
+ - success = true when launch was dispatched successfully
20
+ - failure_code/retryable when launch dispatch fails
21
+ - ui_fingerprint_before/ui_fingerprint_after when available
22
+
23
+ Recommended Usage:
24
+ 1. Define the expected landing screen when it is known
25
+ 2. Call start_app
26
+ 3. If needed, wait for transition using wait_for_*
27
+ 4. Verify with expect_screen
28
+ 5. If verification fails, retry once or capture a snapshot
29
+
30
+ Verification Guidance:
31
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
32
+ - expect_screen is the authoritative verification step when the landing screen is known
33
+ - Do not treat timing or screen change alone as final verification
34
+
35
+ Failure Handling:
36
+ - TIMEOUT → retry once
37
+ - UNKNOWN → inspect snapshot/logs before retrying`,
38
+ inputSchema: {
39
+ type: 'object',
40
+ properties: {
41
+ platform: {
42
+ type: 'string',
43
+ enum: ['android', 'ios']
44
+ },
45
+ appId: {
46
+ type: 'string',
47
+ description: 'Android package name or iOS bundle id'
48
+ },
49
+ deviceId: {
50
+ type: 'string',
51
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
52
+ },
53
+ verificationMode: { type: 'string', enum: ['none', 'light', 'full'], default: 'full' },
54
+ responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' },
55
+ actionTimeoutMs: { type: 'number', minimum: 100, maximum: 30000 },
56
+ verificationTimeoutMs: { type: 'number', minimum: 100, maximum: 60000 }
57
+ },
58
+ required: ['platform', 'appId']
59
+ }
60
+ },
61
+ {
62
+ name: 'terminate_app',
63
+ description: 'Terminate a mobile app on Android or iOS simulator',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ platform: {
68
+ type: 'string',
69
+ enum: ['android', 'ios']
70
+ },
71
+ appId: {
72
+ type: 'string',
73
+ description: 'Android package name or iOS bundle id'
74
+ },
75
+ deviceId: {
76
+ type: 'string',
77
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
78
+ }
79
+ },
80
+ required: ['platform', 'appId']
81
+ }
82
+ },
83
+ {
84
+ name: 'restart_app',
85
+ description: `Purpose:
86
+ Restart a mobile app on Android or iOS.
87
+
88
+ Inputs:
89
+ - platform
90
+ - appId
91
+ - deviceId (optional)
92
+
93
+ Output Structure:
94
+ - action_id, timestamp (ISO 8601), action_type
95
+ - lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
96
+ - source_module: runtime source of the action envelope
97
+ - target.selector = { appId }
98
+ - success = true when the restart command completed
99
+ - failure_code/retryable when restart dispatch fails
100
+ - ui_fingerprint_before/ui_fingerprint_after when available
101
+
102
+ Recommended Usage:
103
+ 1. Define the expected landing screen when it is known
104
+ 2. Call restart_app
105
+ 3. If needed, wait for transition using wait_for_*
106
+ 4. Verify with expect_screen
107
+ 5. If verification fails, retry once or capture a snapshot
108
+
109
+ Verification Guidance:
110
+ - Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
111
+ - expect_screen is the authoritative verification step when the reopened screen is known
112
+ - Do not treat timing or screen change alone as final verification
113
+
114
+ Failure Handling:
115
+ - TIMEOUT → retry once
116
+ - UNKNOWN → inspect snapshot/logs before retrying`,
117
+ inputSchema: {
118
+ type: 'object',
119
+ properties: {
120
+ platform: {
121
+ type: 'string',
122
+ enum: ['android', 'ios']
123
+ },
124
+ appId: {
125
+ type: 'string',
126
+ description: 'Android package name or iOS bundle id'
127
+ },
128
+ deviceId: {
129
+ type: 'string',
130
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
131
+ }
132
+ },
133
+ required: ['platform', 'appId']
134
+ }
135
+ },
136
+ {
137
+ name: 'reset_app_data',
138
+ description: 'Reset app data (clear storage) for a mobile app on Android or iOS simulator',
139
+ inputSchema: {
140
+ type: 'object',
141
+ properties: {
142
+ platform: {
143
+ type: 'string',
144
+ enum: ['android', 'ios']
145
+ },
146
+ appId: {
147
+ type: 'string',
148
+ description: 'Android package name or iOS bundle id'
149
+ },
150
+ deviceId: {
151
+ type: 'string',
152
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
153
+ }
154
+ },
155
+ required: ['platform', 'appId']
156
+ }
157
+ },
158
+ {
159
+ name: 'install_app',
160
+ 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.',
161
+ inputSchema: {
162
+ type: 'object',
163
+ properties: {
164
+ platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to install to (required).' },
165
+ projectType: { type: 'string', enum: ['native', 'kmp', 'react-native', 'flutter'], description: 'Project type to guide build/install tool selection (required).' },
166
+ appPath: { type: 'string', description: 'Path to APK, .app, .ipa, or project directory' },
167
+ deviceId: { type: 'string', description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.' }
168
+ },
169
+ required: ['platform', 'projectType', 'appPath']
170
+ }
171
+ },
172
+ {
173
+ name: 'build_app',
174
+ description: 'Build a project for Android or iOS and return the built artifact path. Does not install. platform and projectType are required.',
175
+ inputSchema: {
176
+ type: 'object',
177
+ properties: {
178
+ platform: { type: 'string', enum: ['android', 'ios'], description: 'Platform to build for (required).' },
179
+ projectType: { type: 'string', enum: ['native', 'kmp', 'react-native', 'flutter'], description: 'Project type to guide build tool selection (required).' },
180
+ projectPath: { type: 'string', description: 'Path to project directory (contains gradlew or xcodeproj/xcworkspace)' },
181
+ variant: { type: 'string', description: 'Optional build variant (e.g., Debug/Release)' }
182
+ },
183
+ required: ['platform', 'projectType', 'projectPath']
184
+ }
185
+ },
186
+ {
187
+ name: 'list_devices',
188
+ description: 'List connected devices and their metadata (android + ios).',
189
+ inputSchema: {
190
+ type: 'object',
191
+ properties: {
192
+ platform: { type: 'string', enum: ['android', 'ios'] }
193
+ }
194
+ }
195
+ }
196
+ ]
@@ -0,0 +1,151 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js'
2
+
3
+ export const observeTools: Tool[] = [
4
+ {
5
+ name: 'get_logs',
6
+ description: 'Get recent logs from Android or iOS simulator. Returns device metadata and structured logs suitable for AI consumption.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ platform: {
11
+ type: 'string',
12
+ enum: ['android', 'ios']
13
+ },
14
+ appId: {
15
+ type: 'string',
16
+ description: 'Filter by Android package name or iOS bundle id'
17
+ },
18
+ deviceId: {
19
+ type: 'string',
20
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
21
+ },
22
+ pid: { type: 'number', description: 'Filter by process id' },
23
+ tag: { type: 'string', description: 'Filter by tag (Android) or subsystem/category (iOS)' },
24
+ level: { type: 'string', description: 'Log level filter (VERBOSE, DEBUG, INFO, WARN, ERROR)' },
25
+ contains: { type: 'string', description: 'Substring to match in log message' },
26
+ since_seconds: { type: 'number', description: 'Only return logs from the last N seconds' },
27
+ limit: { type: 'number', description: 'Override default number of returned lines' },
28
+ lines: {
29
+ type: 'number',
30
+ description: 'Legacy - number of log lines (android only)'
31
+ }
32
+ },
33
+ required: ['platform']
34
+ }
35
+ },
36
+ {
37
+ name: 'capture_screenshot',
38
+ description: 'Capture a screenshot from an Android device or iOS simulator. Returns device metadata and the screenshot image.',
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {
42
+ platform: {
43
+ type: 'string',
44
+ enum: ['android', 'ios']
45
+ },
46
+ deviceId: {
47
+ type: 'string',
48
+ description: 'Device UDID (iOS) or Serial (Android). Defaults to booted/connected.'
49
+ }
50
+ },
51
+ required: ['platform']
52
+ }
53
+ },
54
+ {
55
+ name: 'capture_debug_snapshot',
56
+ 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.',
57
+ inputSchema: {
58
+ type: 'object',
59
+ properties: {
60
+ reason: { type: 'string', description: 'Optional reason for snapshot' },
61
+ includeLogs: { type: 'boolean', description: 'Whether to include logs', default: true },
62
+ includeScreenshot: { type: 'boolean', description: 'Whether to collect screenshot bytes', default: true },
63
+ logLines: { type: 'number', description: 'Maximum number of log lines to include', default: 200 },
64
+ platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override' },
65
+ appId: { type: 'string', description: 'Optional appId to scope logs (package/bundle id)' },
66
+ deviceId: { type: 'string', description: 'Optional device serial/udid' },
67
+ sessionId: { type: 'string', description: 'Optional log stream session id to prefer' }
68
+ }
69
+ }
70
+ },
71
+ {
72
+ name: 'start_log_stream',
73
+ 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.',
74
+ inputSchema: {
75
+ type: 'object',
76
+ properties: {
77
+ platform: { type: 'string', enum: ['android', 'ios'], default: 'android' },
78
+ packageName: { type: 'string', description: 'Android package name or iOS bundle id' },
79
+ level: { type: 'string', enum: ['error', 'warn', 'info', 'debug'], default: 'error' },
80
+ deviceId: { type: 'string', description: 'Device Serial (Android) or UDID (iOS). Defaults to connected/booted device.' },
81
+ sessionId: { type: 'string', description: 'Session identifier for the log stream' }
82
+ },
83
+ required: ['packageName']
84
+ }
85
+ },
86
+ {
87
+ name: 'read_log_stream',
88
+ description: 'Read accumulated log stream entries for the active session.',
89
+ inputSchema: {
90
+ type: 'object',
91
+ properties: {
92
+ sessionId: { type: 'string' }
93
+ }
94
+ }
95
+ },
96
+ {
97
+ name: 'stop_log_stream',
98
+ description: 'Stop an active log stream for the session.',
99
+ inputSchema: {
100
+ type: 'object',
101
+ properties: {
102
+ sessionId: { type: 'string' }
103
+ }
104
+ }
105
+ },
106
+ {
107
+ name: 'get_ui_tree',
108
+ 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.',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ platform: {
113
+ type: 'string',
114
+ enum: ['android', 'ios'],
115
+ description: 'Platform to get UI tree for'
116
+ },
117
+ deviceId: {
118
+ type: 'string',
119
+ description: 'Device Serial (Android) or UDID (iOS). Defaults to connected/booted device.'
120
+ },
121
+ responseMode: { type: 'string', enum: ['compact', 'debug'], default: 'debug' },
122
+ sinceSnapshotRevision: { type: 'number', minimum: 1 }
123
+ },
124
+ required: ['platform']
125
+ }
126
+ },
127
+ {
128
+ name: 'get_current_screen',
129
+ description: 'Get the currently visible activity on an Android device. Returns package and activity name.',
130
+ inputSchema: {
131
+ type: 'object',
132
+ properties: {
133
+ deviceId: {
134
+ type: 'string',
135
+ description: 'Device Serial (Android). Defaults to connected/booted device.'
136
+ }
137
+ }
138
+ }
139
+ },
140
+ {
141
+ name: 'get_screen_fingerprint',
142
+ description: 'Generate a stable fingerprint representing the current visible screen (activity + visible UI elements).',
143
+ inputSchema: {
144
+ type: 'object',
145
+ properties: {
146
+ platform: { type: 'string', enum: ['android', 'ios'], description: 'Optional platform override (android|ios)' },
147
+ deviceId: { type: 'string', description: 'Optional device id/udid to target' }
148
+ }
149
+ }
150
+ }
151
+ ]