@nbakka/mcp-appium 3.0.13 → 3.0.15
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/lib/android.js +3 -3
- package/lib/server.js +5 -24
- package/package.json +1 -1
package/lib/android.js
CHANGED
|
@@ -172,9 +172,9 @@ class AndroidRobot {
|
|
|
172
172
|
}
|
|
173
173
|
async getElementsOnScreen() {
|
|
174
174
|
const parsedXml = await this.getUiAutomatorXml();
|
|
175
|
-
const hierarchy = parsedXml.hierarchy;
|
|
176
|
-
const elements = this.collectElements(hierarchy.node);
|
|
177
|
-
return
|
|
175
|
+
// const hierarchy = parsedXml.hierarchy;
|
|
176
|
+
// const elements = this.collectElements(hierarchy.node);
|
|
177
|
+
return parsedXml;
|
|
178
178
|
}
|
|
179
179
|
async terminateApp(packageName) {
|
|
180
180
|
this.adb("shell", "am", "force-stop", packageName);
|
package/lib/server.js
CHANGED
|
@@ -215,30 +215,11 @@ const createMcpServer = () => {
|
|
|
215
215
|
}
|
|
216
216
|
);
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
type: element.type,
|
|
224
|
-
text: element.text,
|
|
225
|
-
label: element.label,
|
|
226
|
-
name: element.name,
|
|
227
|
-
value: element.value,
|
|
228
|
-
coordinates: {
|
|
229
|
-
x: element.rect.x,
|
|
230
|
-
y: element.rect.y,
|
|
231
|
-
width: element.rect.width,
|
|
232
|
-
height: element.rect.height,
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
if (element.focused) {
|
|
236
|
-
out.focused = true;
|
|
237
|
-
}
|
|
238
|
-
return out;
|
|
239
|
-
});
|
|
240
|
-
return `Found these elements on screen: ${JSON.stringify(result)}`;
|
|
241
|
-
});
|
|
218
|
+
tool("mobile_list_elements_on_screen", "List elements on screen and their coordinates, with display text or accessibility label. Returns the complete XML structure to maintain hierarchy for XPath creation. Do not cache this result.", {}, async ({}) => {
|
|
219
|
+
requireRobot();
|
|
220
|
+
const xmlStructure = await robot.getElementsOnScreen();
|
|
221
|
+
return `Complete XML structure of current screen:\n${xmlStructure}`;
|
|
222
|
+
});
|
|
242
223
|
|
|
243
224
|
tool("mobile_press_button", "Press a button on device", {
|
|
244
225
|
button: zod_1.z.string().describe("The button to press. Supported buttons: BACK (android only), HOME, VOLUME_UP, VOLUME_DOWN, ENTER, DPAD_CENTER (android tv only), DPAD_UP (android tv only), DPAD_DOWN (android tv only), DPAD_LEFT (android tv only), DPAD_RIGHT (android tv only)"),
|