Skip to main content
Glama

native_run_install_app

Install Android APK or iOS app files directly to mobile devices using native-run for development testing and deployment.

Instructions

Install app on device using native-run (works for Android APK & iOS app)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformNoandroid
appPathYes
deviceIdNo

Implementation Reference

  • The main handler function that implements the tool logic: validates input, checks native-run availability, constructs command arguments, executes the native-run install command, handles errors, and returns structured success response.
    handler: async (args: any) => { const parsed = NativeRunInstallAppSchema.parse(args); if (!(await isNativeRunAvailable())) { throw new Error('native-run is not installed. Install with: npm install -g native-run'); } const runArgs = [ parsed.platform, '--app', parsed.appPath, '--device' ]; if (parsed.deviceId) { runArgs.push('--target', parsed.deviceId); } const result = await processExecutor.execute('native-run', runArgs); if (result.exitCode !== 0) { throw new Error(`Failed to install app on ${parsed.platform}: ${result.stderr}`); } return { success: true, data: { message: `App installed successfully on ${parsed.platform}`, platform: parsed.platform, appPath: parsed.appPath, deviceId: parsed.deviceId, tool: 'native-run' }, }; }
  • Zod input validation schema defining parameters: platform (android/ios), appPath (required string), deviceId (optional).
    const NativeRunInstallAppSchema = z.object({ platform: z.enum(['android', 'ios']).default('android'), appPath: z.string().min(1), deviceId: z.string().optional(), });
  • Local registration of the tool in createNativeRunTools() function, defining name, description, inputSchema (JSON schema), and handler reference.
    tools.set('native_run_install_app', { name: 'native_run_install_app', description: 'Install app on device using native-run (works for Android APK & iOS app)', inputSchema: { type: 'object', properties: { platform: { type: 'string', enum: ['android', 'ios'], default: 'android' }, appPath: { type: 'string', minLength: 1 }, deviceId: { type: 'string' } }, required: ['appPath'] }, handler: async (args: any) => { const parsed = NativeRunInstallAppSchema.parse(args); if (!(await isNativeRunAvailable())) { throw new Error('native-run is not installed. Install with: npm install -g native-run'); } const runArgs = [ parsed.platform, '--app', parsed.appPath, '--device' ]; if (parsed.deviceId) { runArgs.push('--target', parsed.deviceId); } const result = await processExecutor.execute('native-run', runArgs); if (result.exitCode !== 0) { throw new Error(`Failed to install app on ${parsed.platform}: ${result.stderr}`); } return { success: true, data: { message: `App installed successfully on ${parsed.platform}`, platform: parsed.platform, appPath: parsed.appPath, deviceId: parsed.deviceId, tool: 'native-run' }, }; } });
  • Top-level registration in createAndroidTools(): imports createNativeRunTools(), calls it to get the tools map, and merges all native-run tools (including native_run_install_app) into the main android tools map.
    const nativeRunTools = createNativeRunTools(); // Merge all tools for (const [name, tool] of gradleTools.entries()) { tools.set(name, tool); } for (const [name, tool] of lintTools.entries()) { tools.set(name, tool); } for (const [name, tool] of mediaTools.entries()) { tools.set(name, tool); } for (const [name, tool] of nativeRunTools.entries()) { tools.set(name, tool); }
  • Helper function to check if native-run CLI is available, used by the handler to validate prerequisite.
    async function isNativeRunAvailable(): Promise<boolean> { try { await processExecutor.execute('native-run', ['--version']); return true; } catch { return false; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cristianoaredes/mcp-mobile-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server