mobile-debug-mcp 0.26.2 → 0.26.4
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.
- package/AGENTS.md +3 -0
- package/dist/interact/index.js +600 -70
- package/dist/observe/ios.js +1 -1
- package/dist/server/tool-definitions.js +59 -1
- package/dist/server/tool-handlers.js +25 -0
- package/dist/server-core.js +1 -1
- package/dist/utils/android/utils.js +2 -2
- package/docs/CHANGELOG.md +6 -0
- package/docs/ROADMAP.md +72 -16
- package/docs/rfcs/007-actionability-resolution-and-executable-target-selection.md +277 -0
- package/docs/rfcs/008-adjustable-control-support-and-semantic-value-manipulation.md +273 -0
- package/docs/specs/mcp-tooling-spec-v1.md +1 -1
- package/docs/tools/interact.md +30 -1
- package/package.json +1 -1
- package/src/interact/index.ts +761 -72
- package/src/observe/ios.ts +1 -1
- package/src/server/tool-definitions.ts +59 -1
- package/src/server/tool-handlers.ts +26 -0
- package/src/server-core.ts +1 -1
- package/src/types.ts +90 -0
- package/src/utils/android/utils.ts +2 -2
- package/test/unit/interact/adjust_control.test.ts +365 -0
- package/test/unit/observe/find_element.test.ts +5 -0
- package/test/unit/observe/state_extraction.test.ts +24 -0
- package/test/unit/server/contract.test.ts +8 -0
- package/test/unit/server/response_shapes.test.ts +39 -0
|
@@ -16,6 +16,7 @@ async function run() {
|
|
|
16
16
|
assert(names.includes('capture_screenshot'))
|
|
17
17
|
assert(names.includes('get_ui_tree'))
|
|
18
18
|
assert(names.includes('tap_element'))
|
|
19
|
+
assert(names.includes('adjust_control'))
|
|
19
20
|
|
|
20
21
|
const waitForUI = toolDefinitions.find((tool) => tool.name === 'wait_for_ui')
|
|
21
22
|
assert(waitForUI, 'wait_for_ui should be registered')
|
|
@@ -66,6 +67,13 @@ async function run() {
|
|
|
66
67
|
assert.match((expectElementVisible as any).description, /selector is the primary input/i)
|
|
67
68
|
assert.match((expectElementVisible as any).description, /Returns structured binary success\/failure only/i)
|
|
68
69
|
|
|
70
|
+
const adjustControl = toolDefinitions.find((tool) => tool.name === 'adjust_control')
|
|
71
|
+
assert(adjustControl, 'adjust_control should be registered')
|
|
72
|
+
assert.deepStrictEqual((adjustControl as any).inputSchema.required, ['targetValue'])
|
|
73
|
+
assert.strictEqual((adjustControl as any).inputSchema.properties.targetValue.type, 'number')
|
|
74
|
+
assert.match((adjustControl as any).description, /numeric control value/i)
|
|
75
|
+
assert.match((adjustControl as any).description, /expect_state/i)
|
|
76
|
+
|
|
69
77
|
const classifyActionOutcome = toolDefinitions.find((tool) => tool.name === 'classify_action_outcome')
|
|
70
78
|
assert(classifyActionOutcome, 'classify_action_outcome should be registered')
|
|
71
79
|
assert.match((classifyActionOutcome as any).description, /action_type/i)
|
|
@@ -14,6 +14,7 @@ async function run() {
|
|
|
14
14
|
const originalExpectScreenHandler = (ToolsInteract as any).expectScreenHandler
|
|
15
15
|
const originalExpectElementVisibleHandler = (ToolsInteract as any).expectElementVisibleHandler
|
|
16
16
|
const originalExpectStateHandler = (ToolsInteract as any).expectStateHandler
|
|
17
|
+
const originalAdjustControlHandler = (ToolsInteract as any).adjustControlHandler
|
|
17
18
|
const originalStartApp = AndroidManage.prototype.startApp
|
|
18
19
|
const originalCaptureScreenshotHandler = (ToolsObserve as any).captureScreenshotHandler
|
|
19
20
|
const originalGetUITreeHandler = (ToolsObserve as any).getUITreeHandler
|
|
@@ -191,6 +192,43 @@ async function run() {
|
|
|
191
192
|
assert.strictEqual(expectStatePayload.expected_state.property, 'checked')
|
|
192
193
|
assert.strictEqual(expectStatePayload.observed_state.value, true)
|
|
193
194
|
|
|
195
|
+
;(ToolsInteract as any).adjustControlHandler = async () => ({
|
|
196
|
+
action_id: 'adjust_control_1',
|
|
197
|
+
timestamp: '2026-04-29T08:00:00.000Z',
|
|
198
|
+
action_type: 'adjust_control',
|
|
199
|
+
lifecycle_state: 'pending_verification',
|
|
200
|
+
source_module: 'interact',
|
|
201
|
+
target: {
|
|
202
|
+
selector: { elementId: 'el_duration' },
|
|
203
|
+
resolved: {
|
|
204
|
+
elementId: 'el_duration',
|
|
205
|
+
text: 'Duration',
|
|
206
|
+
resource_id: null,
|
|
207
|
+
accessibility_id: null,
|
|
208
|
+
class: 'android.view.View',
|
|
209
|
+
bounds: [0, 0, 100, 20],
|
|
210
|
+
index: 0
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
success: true,
|
|
214
|
+
ui_fingerprint_before: 'fp_before',
|
|
215
|
+
ui_fingerprint_after: 'fp_after',
|
|
216
|
+
target_state: { property: 'value', target_value: 30, tolerance: 0.5 },
|
|
217
|
+
actual_state: { property: 'value', value: 30, raw_value: 30 },
|
|
218
|
+
within_tolerance: true,
|
|
219
|
+
converged: true,
|
|
220
|
+
attempts: 1,
|
|
221
|
+
adjustment_mode: 'semantic'
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
const adjustControlResponse = await handleToolCall('adjust_control', { element_id: 'el_duration', targetValue: 30, tolerance: 0.5, property: 'value' })
|
|
225
|
+
const adjustControlPayload = JSON.parse((adjustControlResponse as any).content[0].text)
|
|
226
|
+
assert.strictEqual(adjustControlPayload.success, true)
|
|
227
|
+
assert.strictEqual(adjustControlPayload.action_type, 'adjust_control')
|
|
228
|
+
assert.strictEqual(adjustControlPayload.target_state.target_value, 30)
|
|
229
|
+
assert.strictEqual(adjustControlPayload.within_tolerance, true)
|
|
230
|
+
assert.strictEqual(adjustControlPayload.converged, true)
|
|
231
|
+
|
|
194
232
|
;(ToolsInteract as any).tapHandler = async () => {
|
|
195
233
|
throw new Error('boom')
|
|
196
234
|
}
|
|
@@ -319,6 +357,7 @@ async function run() {
|
|
|
319
357
|
;(ToolsObserve as any).getUITreeHandler = originalGetUITreeHandler
|
|
320
358
|
;(ToolsObserve as any).getScreenFingerprintHandler = originalGetScreenFingerprintHandler
|
|
321
359
|
;(ToolsObserve as any).captureDebugSnapshotHandler = originalCaptureDebugSnapshotHandler
|
|
360
|
+
;(ToolsInteract as any).adjustControlHandler = originalAdjustControlHandler
|
|
322
361
|
}
|
|
323
362
|
}
|
|
324
363
|
|