@nbakka/mcp-appium 3.0.25 → 3.0.26

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 CHANGED
@@ -170,12 +170,16 @@ class AndroidRobot {
170
170
  }
171
171
  return elements;
172
172
  }
173
- async getElementsOnScreen() {
173
+ async getXmlStructure() {
174
174
  const parsedXml = await this.getUiAutomatorXml();
175
- // const hierarchy = parsedXml.hierarchy;
176
- // const elements = this.collectElements(hierarchy.node);
177
175
  return parsedXml;
178
176
  }
177
+ async getElementsOnScreen() {
178
+ const parsedXml = await this.getUiAutomatorXml();
179
+ const hierarchy = parsedXml.hierarchy;
180
+ const elements = this.collectElements(hierarchy.node);
181
+ return elements;
182
+ }
179
183
  async terminateApp(packageName) {
180
184
  this.adb("shell", "am", "force-stop", packageName);
181
185
  }
package/lib/ios.js CHANGED
@@ -124,6 +124,10 @@ class IosRobot {
124
124
  const wda = await this.wda();
125
125
  return await wda.getElementsOnScreen();
126
126
  }
127
+ async getXmlStructure() {
128
+ const wda = await this.wda();
129
+ return await wda.getXmlStructure();
130
+ }
127
131
  async getScreenshot() {
128
132
  await this.assertTunnelRunning();
129
133
  const tmpFilename = path_1.default.join((0, os_1.tmpdir)(), `screenshot-${(0, crypto_1.randomBytes)(8).toString("hex")}.png`);
package/lib/server.js CHANGED
@@ -496,7 +496,7 @@ tool(
496
496
 
497
497
  tool("mobile_list_elements_on_screennn", "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 ({}) => {
498
498
  requireRobot();
499
- const xmlStructure = await robot.getElementsOnScreen();
499
+ const xmlStructure = await robot.getXmlStructure();
500
500
  return `Complete XML structure of current screen: ${JSON.stringify(xmlStructure)}`;
501
501
  });
502
502
 
@@ -159,6 +159,10 @@ class WebDriverAgent {
159
159
  const json = await response.json();
160
160
  return json;
161
161
  }
162
+ async getXmlStructure() {
163
+ const source = await this.getPageSource();
164
+ return source;
165
+ }
162
166
  async getElementsOnScreen() {
163
167
  const source = await this.getPageSource();
164
168
  return this.filterSourceElements(source.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "3.0.25",
3
+ "version": "3.0.26",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"