@mobilenext/mobile-mcp 1.0.5 → 1.0.6

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/README.md CHANGED
@@ -75,6 +75,7 @@ How we help to scale mobile automation:
75
75
  - **`mobile_get_screen_size`** - Get the screen size of the mobile device in pixels
76
76
  - **`mobile_get_orientation`** - Get the current screen orientation of the device
77
77
  - **`mobile_set_orientation`** - Change the screen orientation (portrait/landscape)
78
+ - **`mobile_fold_device`** - Fold or unfold a foldable device (iPhone Duo simulators, foldable Android emulators)
78
79
  - **`mobile_set_location`** - Override the GPS location reported by the device, or clear the override
79
80
  - **`mobile_clipboard`** - Read or replace the device clipboard
80
81
 
@@ -178,6 +178,10 @@ class MobileDevice {
178
178
  const response = this.runJsonCommand(["device", "orientation", "get"]);
179
179
  return response.data.orientation;
180
180
  }
181
+ async fold(posture) {
182
+ // parse the response, older mobilecli versions print help and exit 0 on unknown commands
183
+ this.runJsonCommand(["device", "fold", `${posture}`]);
184
+ }
181
185
  async setLocation(latitude, longitude) {
182
186
  this.runCommand(["device", "location", "set", `${latitude},${longitude}`]);
183
187
  }
package/lib/server.js CHANGED
@@ -671,6 +671,28 @@ const createMcpServer = () => {
671
671
  await robot.setOrientation(orientation);
672
672
  return `Changed device orientation to ${orientation}`;
673
673
  });
674
+ tool("mobile_fold_device", "Fold Device", "Fold or unfold a foldable device, such as iPhone Duo simulators and foldable Android emulators. Provide either posture or angle.", {
675
+ device: zod_1.z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
676
+ posture: zod_1.z.enum(["folded", "half-open", "open"]).optional().describe("The desired hinge posture: folded (0 degrees), half-open (90 degrees) or open (180 degrees)"),
677
+ angle: zod_1.z.number().min(0).max(180).optional().describe("The desired hinge angle in degrees, between 0 (folded) and 180 (open). iOS only, e.g. iPhone Duo. Use instead of posture."),
678
+ }, { readOnlyHint: false, destructiveHint: false, openWorldHint: false }, async ({ device, posture, angle }) => {
679
+ const robot = getRobotFromDevice(device);
680
+ if (!robot.fold) {
681
+ throw new robot_1.ActionableError("Folding the device is not supported in legacy robot mode");
682
+ }
683
+ if (posture !== undefined && angle !== undefined) {
684
+ throw new robot_1.ActionableError("Provide either posture or angle, not both");
685
+ }
686
+ if (posture === undefined && angle === undefined) {
687
+ throw new robot_1.ActionableError("Either posture or angle is required to fold the device");
688
+ }
689
+ if (angle !== undefined) {
690
+ await robot.fold(angle);
691
+ return `Set device hinge angle to ${angle} degrees`;
692
+ }
693
+ await robot.fold(posture);
694
+ return `Changed device posture to ${posture}`;
695
+ });
674
696
  tool("mobile_set_location", "Set Location", "Override the GPS location reported by the device, or clear the override to restore the real location. Omit latitude and longitude to clear.", {
675
697
  device: zod_1.z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
676
698
  latitude: zod_1.z.number().min(-90).max(90).optional().describe("Latitude in decimal degrees, e.g. 37.7749. Omit together with longitude to clear the override."),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mobilenext/mobile-mcp",
3
3
  "mcpName": "io.github.mobile-next/mobile-mcp",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "description": "Mobile MCP",
6
6
  "repository": {
7
7
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "commander": "14.0.0",
33
33
  "express": "5.1.0",
34
34
  "fast-xml-parser": "5.8.0",
35
- "mobilewright": "0.0.60",
35
+ "mobilewright": "0.0.62",
36
36
  "qs": "^6.15.0",
37
37
  "zod": "^4.2.0",
38
38
  "zod-to-json-schema": "3.25.0"