Skip to main content
Glama
mobile-next

Mobile Next MCP Server

Official
by mobile-next

mobile_open_url

Open URLs directly in mobile device browsers to test web content, verify links, or automate navigation tasks on iOS and Android devices.

Instructions

Open a URL in browser on device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
urlYesThe URL to open

Implementation Reference

  • src/server.ts:441-454 (registration)
    Full registration of the MCP tool 'mobile_open_url', including title, description, input schema (device and url), and the handler function. The handler retrieves the appropriate Robot instance based on the device and calls its openUrl method.
    tool(
    	"mobile_open_url",
    	"Open URL",
    	"Open a URL in browser on device",
    	{
    		device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
    		url: z.string().describe("The URL to open"),
    	},
    	async ({ device, url }) => {
    		const robot = getRobotFromDevice(device);
    		await robot.openUrl(url);
    		return `Opened URL: ${url}`;
    	}
    );
  • The executing handler logic for the tool: fetches the Robot for the given device and invokes robot.openUrl(url).
    async ({ device, url }) => {
    	const robot = getRobotFromDevice(device);
    	await robot.openUrl(url);
    	return `Opened URL: ${url}`;
    }
  • Input schema using Zod: requires 'device' (string) and 'url' (string) parameters.
    	device: z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
    	url: z.string().describe("The URL to open"),
    },
  • Helper function getRobotFromDevice that selects the correct Robot subclass (IosRobot, AndroidRobot, or MobileDevice) based on the device ID, used by the tool handler.
    const getRobotFromDevice = (deviceId: string): Robot => {
    
    	// from now on, we must have mobilecli working
    	ensureMobilecliAvailable();
    
    	// Check if it's an iOS device
    	const iosManager = new IosManager();
    	const iosDevices = iosManager.listDevices();
    	const iosDevice = iosDevices.find(d => d.deviceId === deviceId);
    	if (iosDevice) {
    		return new IosRobot(deviceId);
    	}
    
    	// Check if it's an Android device
    	const androidManager = new AndroidDeviceManager();
    	const androidDevices = androidManager.getConnectedDevices();
    	const androidDevice = androidDevices.find(d => d.deviceId === deviceId);
    	if (androidDevice) {
    		return new AndroidRobot(deviceId);
    	}
    
    	// Check if it's a simulator (will later replace all other device types as well)
    	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) {
    			if (device.id === deviceId) {
    				return new MobileDevice(deviceId);
    			}
    		}
    	}
    
    	throw new ActionableError(`Device "${deviceId}" not found. Use the mobile_list_available_devices tool to see available devices.`);
    };

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