Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

List Devices

mobile_list_available_devices
Read-only

Retrieve a list of all available mobile devices and simulators for testing and automation. Select a device from the returned options to proceed with mobile application interactions.

Instructions

List all available devices. This includes both physical devices and simulators. If there is more than one device returned, you need to let the user select one of them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noParamsYes

Implementation Reference

  • The handler function for mobile_list_available_devices tool. It ensures mobilecli is available, then collects devices from Android (emulators), iOS real devices (if available), and iOS simulators via mobilecli, formats them as MobilecliDevice objects, and returns JSON.
    async ({}) => {
    
    	// from today onward, we must have mobilecli working
    	ensureMobilecliAvailable();
    
    	const iosManager = new IosManager();
    	const androidManager = new AndroidDeviceManager();
    	const devices: MobilecliDevice[] = [];
    
    	// Get Android devices with details
    	const androidDevices = androidManager.getConnectedDevicesWithDetails();
    	for (const device of androidDevices) {
    		devices.push({
    			id: device.deviceId,
    			name: device.name,
    			platform: "android",
    			type: "emulator",
    			version: device.version,
    			state: "online",
    		});
    	}
    
    	// Get iOS physical devices with details
    	try {
    		const iosDevices = iosManager.listDevicesWithDetails();
    		for (const device of iosDevices) {
    			devices.push({
    				id: device.deviceId,
    				name: device.deviceName,
    				platform: "ios",
    				type: "real",
    				version: device.version,
    				state: "online",
    			});
    		}
    	} catch (error: any) {
    		// If go-ios is not available, silently skip
    	}
    
    	// Get iOS simulators from mobilecli (excluding offline devices)
    	const response = mobilecli.getDevices({
    		platform: "ios",
    		type: "simulator",
    		includeOffline: false,
    	});
    	if (response.status === "ok" && response.data && response.data.devices) {
    		for (const device of response.data.devices) {
    			devices.push({
    				id: device.id,
    				name: device.name,
    				platform: device.platform,
    				type: device.type,
    				version: device.version,
    				state: "online",
    			});
    		}
    	}
    
    	const out: MobilecliDevicesResponse = { devices };
    	return JSON.stringify(out);
    }
  • src/server.ts:181-249 (registration)
    The registration of the tool using the custom 'tool' helper function, which internally calls server.registerTool with name, title, description, empty inputSchema (noParams), and the handler callback.
    tool(
    	"mobile_list_available_devices",
    	"List Devices",
    	"List all available devices. This includes both physical devices and simulators. If there is more than one device returned, you need to let the user select one of them.",
    	{
    		noParams
    	},
    	async ({}) => {
    
    		// from today onward, we must have mobilecli working
    		ensureMobilecliAvailable();
    
    		const iosManager = new IosManager();
    		const androidManager = new AndroidDeviceManager();
    		const devices: MobilecliDevice[] = [];
    
    		// Get Android devices with details
    		const androidDevices = androidManager.getConnectedDevicesWithDetails();
    		for (const device of androidDevices) {
    			devices.push({
    				id: device.deviceId,
    				name: device.name,
    				platform: "android",
    				type: "emulator",
    				version: device.version,
    				state: "online",
    			});
    		}
    
    		// Get iOS physical devices with details
    		try {
    			const iosDevices = iosManager.listDevicesWithDetails();
    			for (const device of iosDevices) {
    				devices.push({
    					id: device.deviceId,
    					name: device.deviceName,
    					platform: "ios",
    					type: "real",
    					version: device.version,
    					state: "online",
    				});
    			}
    		} catch (error: any) {
    			// If go-ios is not available, silently skip
    		}
    
    		// Get iOS simulators from mobilecli (excluding offline devices)
    		const response = mobilecli.getDevices({
    			platform: "ios",
    			type: "simulator",
    			includeOffline: false,
    		});
    		if (response.status === "ok" && response.data && response.data.devices) {
    			for (const device of response.data.devices) {
    				devices.push({
    					id: device.id,
    					name: device.name,
    					platform: device.platform,
    					type: device.type,
    					version: device.version,
    					state: "online",
    				});
    			}
    		}
    
    		const out: MobilecliDevicesResponse = { devices };
    		return JSON.stringify(out);
    	}
    );
  • The empty Zod schema used as inputSchema for tools that take no parameters, including mobile_list_available_devices.
    const noParams = z.object({});
  • Helper function called by the handler to ensure mobilecli is available before listing devices.
    const ensureMobilecliAvailable = (): void => {
    	try {
    		const version = mobilecli.getVersion();
    		if (version.startsWith("failed")) {
    			throw new Error("mobilecli version check failed");
    		}
    	} catch (error: any) {
    		throw new ActionableError(`mobilecli is not available or not working properly. Please review the documentation at https://github.com/mobile-next/mobile-mcp/wiki for installation instructions`);
    	}
    };
  • Type definitions for devices and response used in the tool implementation.
    interface MobilecliDevice {
    	id: string;
    	name: string;
    	platform: "android" | "ios";
    	type: "real" | "emulator" | "simulator";
    	version: string;
    	state: "online" | "offline";
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds behavioral context beyond annotations: it specifies that the list includes 'both physical devices and simulators' and mentions user interaction for selection when multiple devices are returned. Annotations provide readOnlyHint=true, indicating a safe read operation, which the description doesn't contradict. However, it doesn't disclose other traits like rate limits, pagination, or error handling, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: the first sentence states the core purpose, and the second adds necessary behavioral detail. Both sentences earn their place by providing essential information without redundancy. However, it could be slightly more structured by explicitly separating purpose from guidelines.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (no parameters, read-only operation) and lack of output schema, the description is moderately complete. It covers the purpose and some behavioral aspects but doesn't explain the return format (e.g., device identifiers, types) or error conditions. With annotations handling safety, it's adequate but has clear gaps in output expectations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter (noParams) with 0% description coverage, meaning the schema provides no semantic information. The description compensates by implying no parameters are needed for listing devices, as it doesn't mention any inputs. This effectively clarifies the tool's parameterless nature, though it could be more explicit about the empty parameter requirement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'List all available devices' with the scope 'both physical devices and simulators'. It specifies the verb ('List') and resource ('available devices'), distinguishing it from sibling tools that perform actions on devices (e.g., mobile_click_on_screen_at_coordinates) or list other resources (e.g., mobile_list_apps). However, it doesn't explicitly differentiate from mobile_list_apps in terms of resource type, which slightly reduces specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by stating 'If there is more than one device returned, you need to let the user select one of them', which suggests this tool is for initial device discovery before other operations. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., no mention of prerequisites or comparisons to sibling tools like mobile_get_orientation). The context is clear but not comprehensive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mobile-next/mobile-mcp'

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