the-android-mcp 0.1.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.
- package/LICENSE +21 -0
- package/README.md +624 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +484 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +1145 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +797 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/adb.d.ts +163 -0
- package/dist/utils/adb.d.ts.map +1 -0
- package/dist/utils/adb.js +525 -0
- package/dist/utils/adb.js.map +1 -0
- package/dist/utils/error.d.ts +5 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +50 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/screenshot.d.ts +8 -0
- package/dist/utils/screenshot.d.ts.map +1 -0
- package/dist/utils/screenshot.js +49 -0
- package/dist/utils/screenshot.js.map +1 -0
- package/package.json +72 -0
package/dist/types.js
ADDED
|
@@ -0,0 +1,797 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TapToolSchema = exports.ClearAppDataToolSchema = exports.StopAppToolSchema = exports.StartAppToolSchema = exports.UninstallAppToolSchema = exports.InstallApkToolSchema = exports.FindApkToolSchema = exports.ListDevicesToolSchema = exports.TakeScreenshotToolSchema = exports.HotReloadSetupOutputSchema = exports.ListActivitiesOutputSchema = exports.GetLogcatOutputSchema = exports.ForwardPortOutputSchema = exports.ReversePortOutputSchema = exports.KeyeventOutputSchema = exports.InputTextOutputSchema = exports.SwipeOutputSchema = exports.TapOutputSchema = exports.ClearAppDataOutputSchema = exports.StopAppOutputSchema = exports.StartAppOutputSchema = exports.UninstallAppOutputSchema = exports.InstallApkOutputSchema = exports.FindApkOutputSchema = exports.ListDevicesOutputSchema = exports.TakeScreenshotOutputSchema = exports.HotReloadSetupInputSchema = exports.ListActivitiesInputSchema = exports.GetLogcatInputSchema = exports.ForwardPortInputSchema = exports.ReversePortInputSchema = exports.KeyeventInputSchema = exports.InputTextInputSchema = exports.SwipeInputSchema = exports.TapInputSchema = exports.ClearAppDataInputSchema = exports.StopAppInputSchema = exports.StartAppInputSchema = exports.UninstallAppInputSchema = exports.InstallApkInputSchema = exports.FindApkInputSchema = exports.ListDevicesInputSchema = exports.TakeScreenshotInputSchema = exports.PackageNotRunningError = exports.APKNotFoundError = exports.ScreenshotCaptureError = exports.NoDevicesFoundError = exports.DeviceNotFoundError = exports.ADBNotFoundError = exports.ADBCommandError = void 0;
|
|
4
|
+
exports.HotReloadSetupToolSchema = exports.ListActivitiesToolSchema = exports.GetLogcatToolSchema = exports.ForwardPortToolSchema = exports.ReversePortToolSchema = exports.KeyeventToolSchema = exports.InputTextToolSchema = exports.SwipeToolSchema = void 0;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
class ADBCommandError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
details;
|
|
9
|
+
suggestion;
|
|
10
|
+
constructor(code, message, details, suggestion) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'ADBCommandError';
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.details = details;
|
|
15
|
+
this.suggestion = suggestion;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ADBCommandError = ADBCommandError;
|
|
19
|
+
class ADBNotFoundError extends ADBCommandError {
|
|
20
|
+
constructor() {
|
|
21
|
+
super('ADB_NOT_FOUND', 'Android Debug Bridge (ADB) not found', null, 'Please install Android SDK Platform Tools and ensure ADB is in your PATH');
|
|
22
|
+
this.name = 'ADBNotFoundError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ADBNotFoundError = ADBNotFoundError;
|
|
26
|
+
class DeviceNotFoundError extends ADBCommandError {
|
|
27
|
+
constructor(deviceId) {
|
|
28
|
+
super('DEVICE_NOT_FOUND', `Device with ID '${deviceId}' not found`, { deviceId }, 'Please check if the device is connected and authorized');
|
|
29
|
+
this.name = 'DeviceNotFoundError';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DeviceNotFoundError = DeviceNotFoundError;
|
|
33
|
+
class NoDevicesFoundError extends ADBCommandError {
|
|
34
|
+
constructor() {
|
|
35
|
+
super('NO_DEVICES_FOUND', 'No Android devices found', null, 'Please connect an Android device or start an emulator and ensure USB debugging is enabled');
|
|
36
|
+
this.name = 'NoDevicesFoundError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.NoDevicesFoundError = NoDevicesFoundError;
|
|
40
|
+
class ScreenshotCaptureError extends ADBCommandError {
|
|
41
|
+
constructor(deviceId, originalError) {
|
|
42
|
+
super('SCREENSHOT_CAPTURE_FAILED', `Failed to capture screenshot from device '${deviceId}'`, { deviceId, originalError: originalError?.message }, 'Please ensure the device is connected and screen is unlocked');
|
|
43
|
+
this.name = 'ScreenshotCaptureError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ScreenshotCaptureError = ScreenshotCaptureError;
|
|
47
|
+
class APKNotFoundError extends ADBCommandError {
|
|
48
|
+
constructor(projectRoot, searchedPaths) {
|
|
49
|
+
super('APK_NOT_FOUND', 'No APK files found to install', { projectRoot, searchedPaths }, 'Build a debug APK (e.g., ./gradlew assembleDebug) or provide an apkPath explicitly');
|
|
50
|
+
this.name = 'APKNotFoundError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.APKNotFoundError = APKNotFoundError;
|
|
54
|
+
class PackageNotRunningError extends ADBCommandError {
|
|
55
|
+
constructor(packageName) {
|
|
56
|
+
super('PACKAGE_NOT_RUNNING', `Package '${packageName}' is not running`, { packageName }, 'Start the app before requesting logcat filtered by package');
|
|
57
|
+
this.name = 'PackageNotRunningError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.PackageNotRunningError = PackageNotRunningError;
|
|
61
|
+
// Tool input schemas
|
|
62
|
+
exports.TakeScreenshotInputSchema = zod_1.z.object({
|
|
63
|
+
deviceId: zod_1.z
|
|
64
|
+
.string()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('The ID of the Android device to capture a screenshot from. If not provided, uses the first available device.'),
|
|
67
|
+
format: zod_1.z
|
|
68
|
+
.enum(['png'])
|
|
69
|
+
.default('png')
|
|
70
|
+
.describe('The image format for the screenshot. Currently only PNG is supported.'),
|
|
71
|
+
});
|
|
72
|
+
exports.ListDevicesInputSchema = zod_1.z.object({});
|
|
73
|
+
exports.FindApkInputSchema = zod_1.z.object({
|
|
74
|
+
projectRoot: zod_1.z
|
|
75
|
+
.string()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe('Optional project root to search for APKs. Defaults to current working directory.'),
|
|
78
|
+
});
|
|
79
|
+
exports.InstallApkInputSchema = zod_1.z.object({
|
|
80
|
+
deviceId: zod_1.z
|
|
81
|
+
.string()
|
|
82
|
+
.optional()
|
|
83
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
84
|
+
apkPath: zod_1.z
|
|
85
|
+
.string()
|
|
86
|
+
.optional()
|
|
87
|
+
.describe('Path to APK to install. If omitted, the server searches common build output folders.'),
|
|
88
|
+
projectRoot: zod_1.z
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe('Optional project root to search for APKs when apkPath is omitted.'),
|
|
92
|
+
reinstall: zod_1.z
|
|
93
|
+
.boolean()
|
|
94
|
+
.default(true)
|
|
95
|
+
.describe('Whether to reinstall the APK if it is already installed (-r).'),
|
|
96
|
+
grantPermissions: zod_1.z
|
|
97
|
+
.boolean()
|
|
98
|
+
.default(true)
|
|
99
|
+
.describe('Whether to grant all runtime permissions at install time (-g).'),
|
|
100
|
+
allowTestPackages: zod_1.z
|
|
101
|
+
.boolean()
|
|
102
|
+
.default(false)
|
|
103
|
+
.describe('Whether to allow installing test-only APKs (-t).'),
|
|
104
|
+
allowDowngrade: zod_1.z
|
|
105
|
+
.boolean()
|
|
106
|
+
.default(false)
|
|
107
|
+
.describe('Whether to allow version downgrade (-d).'),
|
|
108
|
+
timeoutMs: zod_1.z
|
|
109
|
+
.number()
|
|
110
|
+
.int()
|
|
111
|
+
.positive()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('Optional timeout in milliseconds for the install command.'),
|
|
114
|
+
});
|
|
115
|
+
exports.UninstallAppInputSchema = zod_1.z.object({
|
|
116
|
+
deviceId: zod_1.z
|
|
117
|
+
.string()
|
|
118
|
+
.optional()
|
|
119
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
120
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name (e.g., com.example.app)'),
|
|
121
|
+
keepData: zod_1.z
|
|
122
|
+
.boolean()
|
|
123
|
+
.default(false)
|
|
124
|
+
.describe('Whether to keep app data and cache directories (-k).'),
|
|
125
|
+
});
|
|
126
|
+
exports.StartAppInputSchema = zod_1.z.object({
|
|
127
|
+
deviceId: zod_1.z
|
|
128
|
+
.string()
|
|
129
|
+
.optional()
|
|
130
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
131
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name (e.g., com.example.app)'),
|
|
132
|
+
activity: zod_1.z
|
|
133
|
+
.string()
|
|
134
|
+
.optional()
|
|
135
|
+
.describe('Optional fully qualified activity name to launch (e.g., .MainActivity).'),
|
|
136
|
+
});
|
|
137
|
+
exports.StopAppInputSchema = zod_1.z.object({
|
|
138
|
+
deviceId: zod_1.z
|
|
139
|
+
.string()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
142
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name (e.g., com.example.app)'),
|
|
143
|
+
});
|
|
144
|
+
exports.ClearAppDataInputSchema = zod_1.z.object({
|
|
145
|
+
deviceId: zod_1.z
|
|
146
|
+
.string()
|
|
147
|
+
.optional()
|
|
148
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
149
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name (e.g., com.example.app)'),
|
|
150
|
+
});
|
|
151
|
+
exports.TapInputSchema = zod_1.z.object({
|
|
152
|
+
deviceId: zod_1.z
|
|
153
|
+
.string()
|
|
154
|
+
.optional()
|
|
155
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
156
|
+
x: zod_1.z.number().int().min(0).describe('Tap X coordinate in pixels.'),
|
|
157
|
+
y: zod_1.z.number().int().min(0).describe('Tap Y coordinate in pixels.'),
|
|
158
|
+
});
|
|
159
|
+
exports.SwipeInputSchema = zod_1.z.object({
|
|
160
|
+
deviceId: zod_1.z
|
|
161
|
+
.string()
|
|
162
|
+
.optional()
|
|
163
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
164
|
+
startX: zod_1.z.number().int().min(0).describe('Start X coordinate in pixels.'),
|
|
165
|
+
startY: zod_1.z.number().int().min(0).describe('Start Y coordinate in pixels.'),
|
|
166
|
+
endX: zod_1.z.number().int().min(0).describe('End X coordinate in pixels.'),
|
|
167
|
+
endY: zod_1.z.number().int().min(0).describe('End Y coordinate in pixels.'),
|
|
168
|
+
durationMs: zod_1.z
|
|
169
|
+
.number()
|
|
170
|
+
.int()
|
|
171
|
+
.min(0)
|
|
172
|
+
.optional()
|
|
173
|
+
.describe('Optional swipe duration in milliseconds.'),
|
|
174
|
+
});
|
|
175
|
+
exports.InputTextInputSchema = zod_1.z.object({
|
|
176
|
+
deviceId: zod_1.z
|
|
177
|
+
.string()
|
|
178
|
+
.optional()
|
|
179
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
180
|
+
text: zod_1.z.string().min(1).describe('Text to input into the focused field.'),
|
|
181
|
+
});
|
|
182
|
+
exports.KeyeventInputSchema = zod_1.z.object({
|
|
183
|
+
deviceId: zod_1.z
|
|
184
|
+
.string()
|
|
185
|
+
.optional()
|
|
186
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
187
|
+
keyCode: zod_1.z
|
|
188
|
+
.union([zod_1.z.string(), zod_1.z.number().int()])
|
|
189
|
+
.describe('Android keycode (e.g., 3 for HOME, 4 for BACK, KEYCODE_ENTER).'),
|
|
190
|
+
});
|
|
191
|
+
exports.ReversePortInputSchema = zod_1.z.object({
|
|
192
|
+
deviceId: zod_1.z
|
|
193
|
+
.string()
|
|
194
|
+
.optional()
|
|
195
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
196
|
+
devicePort: zod_1.z.number().int().positive().describe('Device port to reverse (tcp).'),
|
|
197
|
+
hostPort: zod_1.z
|
|
198
|
+
.number()
|
|
199
|
+
.int()
|
|
200
|
+
.positive()
|
|
201
|
+
.optional()
|
|
202
|
+
.describe('Host port to map to. Defaults to the same as devicePort.'),
|
|
203
|
+
});
|
|
204
|
+
exports.ForwardPortInputSchema = zod_1.z.object({
|
|
205
|
+
deviceId: zod_1.z
|
|
206
|
+
.string()
|
|
207
|
+
.optional()
|
|
208
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
209
|
+
devicePort: zod_1.z.number().int().positive().describe('Device port to forward to (tcp).'),
|
|
210
|
+
hostPort: zod_1.z.number().int().positive().describe('Host port to forward from (tcp).'),
|
|
211
|
+
});
|
|
212
|
+
exports.GetLogcatInputSchema = zod_1.z.object({
|
|
213
|
+
deviceId: zod_1.z
|
|
214
|
+
.string()
|
|
215
|
+
.optional()
|
|
216
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
217
|
+
lines: zod_1.z
|
|
218
|
+
.number()
|
|
219
|
+
.int()
|
|
220
|
+
.positive()
|
|
221
|
+
.default(200)
|
|
222
|
+
.describe('Number of log lines to return.'),
|
|
223
|
+
since: zod_1.z
|
|
224
|
+
.string()
|
|
225
|
+
.optional()
|
|
226
|
+
.describe('Optional time filter (e.g., "1m", "2024-01-01 00:00:00.000").'),
|
|
227
|
+
tag: zod_1.z.string().optional().describe('Optional log tag filter.'),
|
|
228
|
+
priority: zod_1.z
|
|
229
|
+
.enum(['V', 'D', 'I', 'W', 'E', 'F', 'S'])
|
|
230
|
+
.optional()
|
|
231
|
+
.describe('Optional minimum priority for the tag filter.'),
|
|
232
|
+
pid: zod_1.z.number().int().positive().optional().describe('Optional PID to filter logs by.'),
|
|
233
|
+
packageName: zod_1.z
|
|
234
|
+
.string()
|
|
235
|
+
.optional()
|
|
236
|
+
.describe('Optional package name to filter logs by running PID.'),
|
|
237
|
+
format: zod_1.z
|
|
238
|
+
.enum(['time', 'threadtime', 'brief', 'raw'])
|
|
239
|
+
.default('time')
|
|
240
|
+
.describe('Logcat output format.'),
|
|
241
|
+
});
|
|
242
|
+
exports.ListActivitiesInputSchema = zod_1.z.object({
|
|
243
|
+
deviceId: zod_1.z
|
|
244
|
+
.string()
|
|
245
|
+
.optional()
|
|
246
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
247
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name.'),
|
|
248
|
+
});
|
|
249
|
+
exports.HotReloadSetupInputSchema = zod_1.z.object({
|
|
250
|
+
deviceId: zod_1.z
|
|
251
|
+
.string()
|
|
252
|
+
.optional()
|
|
253
|
+
.describe('Optional device ID. If not provided, uses the first available device.'),
|
|
254
|
+
packageName: zod_1.z.string().min(1).describe('Android application package name.'),
|
|
255
|
+
activity: zod_1.z
|
|
256
|
+
.string()
|
|
257
|
+
.optional()
|
|
258
|
+
.describe('Optional activity to launch (e.g., .MainActivity).'),
|
|
259
|
+
apkPath: zod_1.z
|
|
260
|
+
.string()
|
|
261
|
+
.optional()
|
|
262
|
+
.describe('Optional APK path to install before starting.'),
|
|
263
|
+
projectRoot: zod_1.z
|
|
264
|
+
.string()
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('Optional project root used to auto-detect APKs.'),
|
|
267
|
+
reversePorts: zod_1.z
|
|
268
|
+
.array(zod_1.z.object({
|
|
269
|
+
devicePort: zod_1.z.number().int().positive().describe('Device port to reverse (tcp).'),
|
|
270
|
+
hostPort: zod_1.z.number().int().positive().optional().describe('Host port to map to.'),
|
|
271
|
+
}))
|
|
272
|
+
.optional()
|
|
273
|
+
.default([{ devicePort: 8081 }])
|
|
274
|
+
.describe('TCP ports to reverse for hot reload (defaults to 8081).'),
|
|
275
|
+
install: zod_1.z.boolean().default(true).describe('Whether to install an APK before starting.'),
|
|
276
|
+
start: zod_1.z.boolean().default(true).describe('Whether to start the app after setup.'),
|
|
277
|
+
stopBeforeStart: zod_1.z
|
|
278
|
+
.boolean()
|
|
279
|
+
.default(false)
|
|
280
|
+
.describe('Whether to force-stop the app before starting it.'),
|
|
281
|
+
reinstall: zod_1.z.boolean().default(true).describe('Reinstall if already installed (-r).'),
|
|
282
|
+
grantPermissions: zod_1.z.boolean().default(true).describe('Grant runtime permissions at install (-g).'),
|
|
283
|
+
allowTestPackages: zod_1.z
|
|
284
|
+
.boolean()
|
|
285
|
+
.default(false)
|
|
286
|
+
.describe('Allow installing test-only APKs (-t).'),
|
|
287
|
+
allowDowngrade: zod_1.z.boolean().default(false).describe('Allow version downgrade (-d).'),
|
|
288
|
+
timeoutMs: zod_1.z
|
|
289
|
+
.number()
|
|
290
|
+
.int()
|
|
291
|
+
.positive()
|
|
292
|
+
.optional()
|
|
293
|
+
.describe('Optional timeout in milliseconds for install.'),
|
|
294
|
+
});
|
|
295
|
+
// Tool output schemas
|
|
296
|
+
exports.TakeScreenshotOutputSchema = zod_1.z.object({
|
|
297
|
+
data: zod_1.z.string().describe('Base64 encoded image data'),
|
|
298
|
+
format: zod_1.z.string().describe('Image format (png)'),
|
|
299
|
+
width: zod_1.z.number().describe('Image width in pixels'),
|
|
300
|
+
height: zod_1.z.number().describe('Image height in pixels'),
|
|
301
|
+
deviceId: zod_1.z.string().describe('ID of the device the screenshot was taken from'),
|
|
302
|
+
timestamp: zod_1.z.number().describe('Unix timestamp when the screenshot was captured'),
|
|
303
|
+
});
|
|
304
|
+
exports.ListDevicesOutputSchema = zod_1.z.object({
|
|
305
|
+
devices: zod_1.z
|
|
306
|
+
.array(zod_1.z.object({
|
|
307
|
+
id: zod_1.z.string().describe('Device ID'),
|
|
308
|
+
status: zod_1.z.string().describe('Device status'),
|
|
309
|
+
model: zod_1.z.string().optional().describe('Device model'),
|
|
310
|
+
product: zod_1.z.string().optional().describe('Product name'),
|
|
311
|
+
transportId: zod_1.z.string().optional().describe('Transport ID'),
|
|
312
|
+
usb: zod_1.z.string().optional().describe('USB information'),
|
|
313
|
+
productString: zod_1.z.string().optional().describe('Product string'),
|
|
314
|
+
}))
|
|
315
|
+
.describe('List of connected Android devices'),
|
|
316
|
+
});
|
|
317
|
+
exports.FindApkOutputSchema = zod_1.z.object({
|
|
318
|
+
projectRoot: zod_1.z.string().describe('Resolved project root used for the search'),
|
|
319
|
+
apkPath: zod_1.z.string().describe('Selected APK path (most recent match)'),
|
|
320
|
+
candidates: zod_1.z.array(zod_1.z.string()).describe('All APK candidates found (sorted by newest first)'),
|
|
321
|
+
});
|
|
322
|
+
exports.InstallApkOutputSchema = zod_1.z.object({
|
|
323
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
324
|
+
apkPath: zod_1.z.string().describe('Installed APK path'),
|
|
325
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
326
|
+
success: zod_1.z.boolean().describe('Whether the install reported success'),
|
|
327
|
+
});
|
|
328
|
+
exports.UninstallAppOutputSchema = zod_1.z.object({
|
|
329
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
330
|
+
packageName: zod_1.z.string().describe('Android package name'),
|
|
331
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
332
|
+
success: zod_1.z.boolean().describe('Whether the uninstall reported success'),
|
|
333
|
+
});
|
|
334
|
+
exports.StartAppOutputSchema = zod_1.z.object({
|
|
335
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
336
|
+
packageName: zod_1.z.string().describe('Android package name'),
|
|
337
|
+
activity: zod_1.z.string().optional().describe('Launched activity (if provided)'),
|
|
338
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
339
|
+
});
|
|
340
|
+
exports.StopAppOutputSchema = zod_1.z.object({
|
|
341
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
342
|
+
packageName: zod_1.z.string().describe('Android package name'),
|
|
343
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
344
|
+
});
|
|
345
|
+
exports.ClearAppDataOutputSchema = zod_1.z.object({
|
|
346
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
347
|
+
packageName: zod_1.z.string().describe('Android package name'),
|
|
348
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
349
|
+
success: zod_1.z.boolean().describe('Whether the clear data command reported success'),
|
|
350
|
+
});
|
|
351
|
+
exports.TapOutputSchema = zod_1.z.object({
|
|
352
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
353
|
+
x: zod_1.z.number().describe('Tap X coordinate'),
|
|
354
|
+
y: zod_1.z.number().describe('Tap Y coordinate'),
|
|
355
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
356
|
+
});
|
|
357
|
+
exports.SwipeOutputSchema = zod_1.z.object({
|
|
358
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
359
|
+
startX: zod_1.z.number().describe('Start X coordinate'),
|
|
360
|
+
startY: zod_1.z.number().describe('Start Y coordinate'),
|
|
361
|
+
endX: zod_1.z.number().describe('End X coordinate'),
|
|
362
|
+
endY: zod_1.z.number().describe('End Y coordinate'),
|
|
363
|
+
durationMs: zod_1.z.number().optional().describe('Swipe duration in milliseconds'),
|
|
364
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
365
|
+
});
|
|
366
|
+
exports.InputTextOutputSchema = zod_1.z.object({
|
|
367
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
368
|
+
text: zod_1.z.string().describe('Input text'),
|
|
369
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
370
|
+
});
|
|
371
|
+
exports.KeyeventOutputSchema = zod_1.z.object({
|
|
372
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
373
|
+
keyCode: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).describe('Android keycode'),
|
|
374
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
375
|
+
});
|
|
376
|
+
exports.ReversePortOutputSchema = zod_1.z.object({
|
|
377
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
378
|
+
devicePort: zod_1.z.number().describe('Device port (tcp)'),
|
|
379
|
+
hostPort: zod_1.z.number().describe('Host port (tcp)'),
|
|
380
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
381
|
+
});
|
|
382
|
+
exports.ForwardPortOutputSchema = zod_1.z.object({
|
|
383
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
384
|
+
devicePort: zod_1.z.number().describe('Device port (tcp)'),
|
|
385
|
+
hostPort: zod_1.z.number().describe('Host port (tcp)'),
|
|
386
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
387
|
+
});
|
|
388
|
+
exports.GetLogcatOutputSchema = zod_1.z.object({
|
|
389
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
390
|
+
output: zod_1.z.string().describe('Logcat output'),
|
|
391
|
+
lines: zod_1.z.number().describe('Number of lines requested'),
|
|
392
|
+
pid: zod_1.z.number().optional().describe('PID used for filtering'),
|
|
393
|
+
packageName: zod_1.z.string().optional().describe('Package name used for filtering'),
|
|
394
|
+
});
|
|
395
|
+
exports.ListActivitiesOutputSchema = zod_1.z.object({
|
|
396
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
397
|
+
packageName: zod_1.z.string().describe('Android package name'),
|
|
398
|
+
activities: zod_1.z.array(zod_1.z.string()).describe('Discovered activity class names'),
|
|
399
|
+
mainActivity: zod_1.z.string().optional().describe('Resolved main/launcher activity (if found)'),
|
|
400
|
+
});
|
|
401
|
+
exports.HotReloadSetupOutputSchema = zod_1.z.object({
|
|
402
|
+
deviceId: zod_1.z.string().describe('Target device ID'),
|
|
403
|
+
reversedPorts: zod_1.z
|
|
404
|
+
.array(zod_1.z.object({
|
|
405
|
+
devicePort: zod_1.z.number().describe('Device port (tcp)'),
|
|
406
|
+
hostPort: zod_1.z.number().describe('Host port (tcp)'),
|
|
407
|
+
output: zod_1.z.string().describe('Raw ADB output'),
|
|
408
|
+
}))
|
|
409
|
+
.describe('Port reverse results'),
|
|
410
|
+
install: exports.InstallApkOutputSchema.optional().describe('APK install result (if performed)'),
|
|
411
|
+
stop: exports.StopAppOutputSchema.optional().describe('Stop result (if performed)'),
|
|
412
|
+
start: exports.StartAppOutputSchema.optional().describe('Start result (if performed)'),
|
|
413
|
+
});
|
|
414
|
+
// MCP Tool schemas
|
|
415
|
+
exports.TakeScreenshotToolSchema = {
|
|
416
|
+
type: 'object',
|
|
417
|
+
properties: {
|
|
418
|
+
deviceId: {
|
|
419
|
+
type: 'string',
|
|
420
|
+
description: 'The ID of the Android device to capture a screenshot from. If not provided, uses the first available device.',
|
|
421
|
+
},
|
|
422
|
+
format: {
|
|
423
|
+
type: 'string',
|
|
424
|
+
enum: ['png'],
|
|
425
|
+
default: 'png',
|
|
426
|
+
description: 'The image format for the screenshot. Currently only PNG is supported.',
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
required: [],
|
|
430
|
+
};
|
|
431
|
+
exports.ListDevicesToolSchema = {
|
|
432
|
+
type: 'object',
|
|
433
|
+
properties: {},
|
|
434
|
+
required: [],
|
|
435
|
+
};
|
|
436
|
+
exports.FindApkToolSchema = {
|
|
437
|
+
type: 'object',
|
|
438
|
+
properties: {
|
|
439
|
+
projectRoot: {
|
|
440
|
+
type: 'string',
|
|
441
|
+
description: 'Optional project root to search for APKs. Defaults to current working directory.',
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
required: [],
|
|
445
|
+
};
|
|
446
|
+
exports.InstallApkToolSchema = {
|
|
447
|
+
type: 'object',
|
|
448
|
+
properties: {
|
|
449
|
+
deviceId: {
|
|
450
|
+
type: 'string',
|
|
451
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
452
|
+
},
|
|
453
|
+
apkPath: {
|
|
454
|
+
type: 'string',
|
|
455
|
+
description: 'Path to APK to install. If omitted, the server searches common build output folders.',
|
|
456
|
+
},
|
|
457
|
+
projectRoot: {
|
|
458
|
+
type: 'string',
|
|
459
|
+
description: 'Optional project root to search for APKs when apkPath is omitted.',
|
|
460
|
+
},
|
|
461
|
+
reinstall: {
|
|
462
|
+
type: 'boolean',
|
|
463
|
+
description: 'Whether to reinstall the APK if it is already installed (-r).',
|
|
464
|
+
default: true,
|
|
465
|
+
},
|
|
466
|
+
grantPermissions: {
|
|
467
|
+
type: 'boolean',
|
|
468
|
+
description: 'Whether to grant all runtime permissions at install time (-g).',
|
|
469
|
+
default: true,
|
|
470
|
+
},
|
|
471
|
+
allowTestPackages: {
|
|
472
|
+
type: 'boolean',
|
|
473
|
+
description: 'Whether to allow installing test-only APKs (-t).',
|
|
474
|
+
default: false,
|
|
475
|
+
},
|
|
476
|
+
allowDowngrade: {
|
|
477
|
+
type: 'boolean',
|
|
478
|
+
description: 'Whether to allow version downgrade (-d).',
|
|
479
|
+
default: false,
|
|
480
|
+
},
|
|
481
|
+
timeoutMs: {
|
|
482
|
+
type: 'number',
|
|
483
|
+
description: 'Optional timeout in milliseconds for the install command.',
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
required: [],
|
|
487
|
+
};
|
|
488
|
+
exports.UninstallAppToolSchema = {
|
|
489
|
+
type: 'object',
|
|
490
|
+
properties: {
|
|
491
|
+
deviceId: {
|
|
492
|
+
type: 'string',
|
|
493
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
494
|
+
},
|
|
495
|
+
packageName: {
|
|
496
|
+
type: 'string',
|
|
497
|
+
description: 'Android application package name (e.g., com.example.app).',
|
|
498
|
+
},
|
|
499
|
+
keepData: {
|
|
500
|
+
type: 'boolean',
|
|
501
|
+
description: 'Whether to keep app data and cache directories (-k).',
|
|
502
|
+
default: false,
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
required: ['packageName'],
|
|
506
|
+
};
|
|
507
|
+
exports.StartAppToolSchema = {
|
|
508
|
+
type: 'object',
|
|
509
|
+
properties: {
|
|
510
|
+
deviceId: {
|
|
511
|
+
type: 'string',
|
|
512
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
513
|
+
},
|
|
514
|
+
packageName: {
|
|
515
|
+
type: 'string',
|
|
516
|
+
description: 'Android application package name (e.g., com.example.app).',
|
|
517
|
+
},
|
|
518
|
+
activity: {
|
|
519
|
+
type: 'string',
|
|
520
|
+
description: 'Optional fully qualified activity name to launch (e.g., .MainActivity).',
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
required: ['packageName'],
|
|
524
|
+
};
|
|
525
|
+
exports.StopAppToolSchema = {
|
|
526
|
+
type: 'object',
|
|
527
|
+
properties: {
|
|
528
|
+
deviceId: {
|
|
529
|
+
type: 'string',
|
|
530
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
531
|
+
},
|
|
532
|
+
packageName: {
|
|
533
|
+
type: 'string',
|
|
534
|
+
description: 'Android application package name (e.g., com.example.app).',
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
required: ['packageName'],
|
|
538
|
+
};
|
|
539
|
+
exports.ClearAppDataToolSchema = {
|
|
540
|
+
type: 'object',
|
|
541
|
+
properties: {
|
|
542
|
+
deviceId: {
|
|
543
|
+
type: 'string',
|
|
544
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
545
|
+
},
|
|
546
|
+
packageName: {
|
|
547
|
+
type: 'string',
|
|
548
|
+
description: 'Android application package name (e.g., com.example.app).',
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
required: ['packageName'],
|
|
552
|
+
};
|
|
553
|
+
exports.TapToolSchema = {
|
|
554
|
+
type: 'object',
|
|
555
|
+
properties: {
|
|
556
|
+
deviceId: {
|
|
557
|
+
type: 'string',
|
|
558
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
559
|
+
},
|
|
560
|
+
x: {
|
|
561
|
+
type: 'number',
|
|
562
|
+
description: 'Tap X coordinate in pixels.',
|
|
563
|
+
},
|
|
564
|
+
y: {
|
|
565
|
+
type: 'number',
|
|
566
|
+
description: 'Tap Y coordinate in pixels.',
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
required: ['x', 'y'],
|
|
570
|
+
};
|
|
571
|
+
exports.SwipeToolSchema = {
|
|
572
|
+
type: 'object',
|
|
573
|
+
properties: {
|
|
574
|
+
deviceId: {
|
|
575
|
+
type: 'string',
|
|
576
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
577
|
+
},
|
|
578
|
+
startX: {
|
|
579
|
+
type: 'number',
|
|
580
|
+
description: 'Start X coordinate in pixels.',
|
|
581
|
+
},
|
|
582
|
+
startY: {
|
|
583
|
+
type: 'number',
|
|
584
|
+
description: 'Start Y coordinate in pixels.',
|
|
585
|
+
},
|
|
586
|
+
endX: {
|
|
587
|
+
type: 'number',
|
|
588
|
+
description: 'End X coordinate in pixels.',
|
|
589
|
+
},
|
|
590
|
+
endY: {
|
|
591
|
+
type: 'number',
|
|
592
|
+
description: 'End Y coordinate in pixels.',
|
|
593
|
+
},
|
|
594
|
+
durationMs: {
|
|
595
|
+
type: 'number',
|
|
596
|
+
description: 'Optional swipe duration in milliseconds.',
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
required: ['startX', 'startY', 'endX', 'endY'],
|
|
600
|
+
};
|
|
601
|
+
exports.InputTextToolSchema = {
|
|
602
|
+
type: 'object',
|
|
603
|
+
properties: {
|
|
604
|
+
deviceId: {
|
|
605
|
+
type: 'string',
|
|
606
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
607
|
+
},
|
|
608
|
+
text: {
|
|
609
|
+
type: 'string',
|
|
610
|
+
description: 'Text to input into the focused field.',
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
required: ['text'],
|
|
614
|
+
};
|
|
615
|
+
exports.KeyeventToolSchema = {
|
|
616
|
+
type: 'object',
|
|
617
|
+
properties: {
|
|
618
|
+
deviceId: {
|
|
619
|
+
type: 'string',
|
|
620
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
621
|
+
},
|
|
622
|
+
keyCode: {
|
|
623
|
+
type: 'string',
|
|
624
|
+
description: 'Android keycode (e.g., 3 for HOME, 4 for BACK, KEYCODE_ENTER).',
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
required: ['keyCode'],
|
|
628
|
+
};
|
|
629
|
+
exports.ReversePortToolSchema = {
|
|
630
|
+
type: 'object',
|
|
631
|
+
properties: {
|
|
632
|
+
deviceId: {
|
|
633
|
+
type: 'string',
|
|
634
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
635
|
+
},
|
|
636
|
+
devicePort: {
|
|
637
|
+
type: 'number',
|
|
638
|
+
description: 'Device port to reverse (tcp).',
|
|
639
|
+
},
|
|
640
|
+
hostPort: {
|
|
641
|
+
type: 'number',
|
|
642
|
+
description: 'Host port to map to. Defaults to the same as devicePort.',
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
required: ['devicePort'],
|
|
646
|
+
};
|
|
647
|
+
exports.ForwardPortToolSchema = {
|
|
648
|
+
type: 'object',
|
|
649
|
+
properties: {
|
|
650
|
+
deviceId: {
|
|
651
|
+
type: 'string',
|
|
652
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
653
|
+
},
|
|
654
|
+
devicePort: {
|
|
655
|
+
type: 'number',
|
|
656
|
+
description: 'Device port to forward to (tcp).',
|
|
657
|
+
},
|
|
658
|
+
hostPort: {
|
|
659
|
+
type: 'number',
|
|
660
|
+
description: 'Host port to forward from (tcp).',
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
required: ['devicePort', 'hostPort'],
|
|
664
|
+
};
|
|
665
|
+
exports.GetLogcatToolSchema = {
|
|
666
|
+
type: 'object',
|
|
667
|
+
properties: {
|
|
668
|
+
deviceId: {
|
|
669
|
+
type: 'string',
|
|
670
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
671
|
+
},
|
|
672
|
+
lines: {
|
|
673
|
+
type: 'number',
|
|
674
|
+
description: 'Number of log lines to return.',
|
|
675
|
+
default: 200,
|
|
676
|
+
},
|
|
677
|
+
since: {
|
|
678
|
+
type: 'string',
|
|
679
|
+
description: 'Optional time filter (e.g., "1m", "2024-01-01 00:00:00.000").',
|
|
680
|
+
},
|
|
681
|
+
tag: {
|
|
682
|
+
type: 'string',
|
|
683
|
+
description: 'Optional log tag filter.',
|
|
684
|
+
},
|
|
685
|
+
priority: {
|
|
686
|
+
type: 'string',
|
|
687
|
+
description: 'Optional minimum priority (V/D/I/W/E/F/S).',
|
|
688
|
+
},
|
|
689
|
+
pid: {
|
|
690
|
+
type: 'number',
|
|
691
|
+
description: 'Optional PID to filter logs by.',
|
|
692
|
+
},
|
|
693
|
+
packageName: {
|
|
694
|
+
type: 'string',
|
|
695
|
+
description: 'Optional package name to filter logs by running PID.',
|
|
696
|
+
},
|
|
697
|
+
format: {
|
|
698
|
+
type: 'string',
|
|
699
|
+
description: 'Logcat output format (time/threadtime/brief/raw).',
|
|
700
|
+
default: 'time',
|
|
701
|
+
},
|
|
702
|
+
},
|
|
703
|
+
required: [],
|
|
704
|
+
};
|
|
705
|
+
exports.ListActivitiesToolSchema = {
|
|
706
|
+
type: 'object',
|
|
707
|
+
properties: {
|
|
708
|
+
deviceId: {
|
|
709
|
+
type: 'string',
|
|
710
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
711
|
+
},
|
|
712
|
+
packageName: {
|
|
713
|
+
type: 'string',
|
|
714
|
+
description: 'Android application package name.',
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
required: ['packageName'],
|
|
718
|
+
};
|
|
719
|
+
exports.HotReloadSetupToolSchema = {
|
|
720
|
+
type: 'object',
|
|
721
|
+
properties: {
|
|
722
|
+
deviceId: {
|
|
723
|
+
type: 'string',
|
|
724
|
+
description: 'Optional device ID. If not provided, uses the first available device.',
|
|
725
|
+
},
|
|
726
|
+
packageName: {
|
|
727
|
+
type: 'string',
|
|
728
|
+
description: 'Android application package name.',
|
|
729
|
+
},
|
|
730
|
+
activity: {
|
|
731
|
+
type: 'string',
|
|
732
|
+
description: 'Optional activity to launch (e.g., .MainActivity).',
|
|
733
|
+
},
|
|
734
|
+
apkPath: {
|
|
735
|
+
type: 'string',
|
|
736
|
+
description: 'Optional APK path to install before starting.',
|
|
737
|
+
},
|
|
738
|
+
projectRoot: {
|
|
739
|
+
type: 'string',
|
|
740
|
+
description: 'Optional project root used to auto-detect APKs.',
|
|
741
|
+
},
|
|
742
|
+
reversePorts: {
|
|
743
|
+
type: 'array',
|
|
744
|
+
description: 'TCP ports to reverse for hot reload (defaults to 8081).',
|
|
745
|
+
items: {
|
|
746
|
+
type: 'object',
|
|
747
|
+
properties: {
|
|
748
|
+
devicePort: { type: 'number' },
|
|
749
|
+
hostPort: { type: 'number' },
|
|
750
|
+
},
|
|
751
|
+
required: ['devicePort'],
|
|
752
|
+
},
|
|
753
|
+
default: [{ devicePort: 8081 }],
|
|
754
|
+
},
|
|
755
|
+
install: {
|
|
756
|
+
type: 'boolean',
|
|
757
|
+
description: 'Whether to install an APK before starting.',
|
|
758
|
+
default: true,
|
|
759
|
+
},
|
|
760
|
+
start: {
|
|
761
|
+
type: 'boolean',
|
|
762
|
+
description: 'Whether to start the app after setup.',
|
|
763
|
+
default: true,
|
|
764
|
+
},
|
|
765
|
+
stopBeforeStart: {
|
|
766
|
+
type: 'boolean',
|
|
767
|
+
description: 'Whether to force-stop the app before starting it.',
|
|
768
|
+
default: false,
|
|
769
|
+
},
|
|
770
|
+
reinstall: {
|
|
771
|
+
type: 'boolean',
|
|
772
|
+
description: 'Reinstall if already installed (-r).',
|
|
773
|
+
default: true,
|
|
774
|
+
},
|
|
775
|
+
grantPermissions: {
|
|
776
|
+
type: 'boolean',
|
|
777
|
+
description: 'Grant runtime permissions at install (-g).',
|
|
778
|
+
default: true,
|
|
779
|
+
},
|
|
780
|
+
allowTestPackages: {
|
|
781
|
+
type: 'boolean',
|
|
782
|
+
description: 'Allow installing test-only APKs (-t).',
|
|
783
|
+
default: false,
|
|
784
|
+
},
|
|
785
|
+
allowDowngrade: {
|
|
786
|
+
type: 'boolean',
|
|
787
|
+
description: 'Allow version downgrade (-d).',
|
|
788
|
+
default: false,
|
|
789
|
+
},
|
|
790
|
+
timeoutMs: {
|
|
791
|
+
type: 'number',
|
|
792
|
+
description: 'Optional timeout in milliseconds for install.',
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
required: ['packageName'],
|
|
796
|
+
};
|
|
797
|
+
//# sourceMappingURL=types.js.map
|