Skip to main content
Glama
zillow
by zillow

openLink

Open URLs in the default browser on Android or iOS devices for mobile automation testing and navigation.

Instructions

Open a URL in the default browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to open in the default browser
platformYesPlatform of the device

Implementation Reference

  • Handler function that creates an OpenURL instance and executes it with the provided URL, returning a standardized tool response.
    const openLinkHandler = async (device: BootedDevice, args: OpenLinkArgs) => {
      const openUrl = new OpenURL(device);
      const result = await openUrl.execute(args.url);
    
      return createJSONToolResponse({
        message: `Opened link ${args.url}`,
        observation: result.observation,
        ...result
      });
    };
  • Zod schema defining the input arguments for the openLink tool: url and platform.
    export const openLinkSchema = z.object({
      url: z.string().describe("URL to open in the default browser"),
      platform: z.enum(["android", "ios"]).describe("Platform of the device")
    });
  • Registration of the openLink tool with ToolRegistry, including name, description, schema, and handler.
      "openLink",
      "Open a URL in the default browser",
      openLinkSchema,
      openLinkHandler,
      false // Does not support progress notifications
    );
  • OpenURL class providing the core implementation for opening URLs on Android (via adb am start) and iOS (via axe.openUrl), used by the openLink handler.
    export class OpenURL extends BaseVisualChange {
    
      constructor(device: BootedDevice, adb: AdbUtils | null = null, axe: Axe | null = null) {
        super(device, adb, axe);
        this.device = device;
      }
    
      async execute(
        url: string,
      ): Promise<OpenURLResult> {
        logger.info(`[OpenURL] Starting URL open request: ${url}`);
    
        // Validate URL
        if (!url || !url.trim()) {
          logger.error("[OpenURL] Invalid URL provided");
          return {
            success: false,
            url: url || "",
            error: "Invalid URL provided"
          };
        }
    
        const trimmedUrl = url.trim();
        logger.info(`[OpenURL] Processing URL: ${trimmedUrl}`);
    
        // Handle package: URLs specially - delegate to LaunchApp
        if (trimmedUrl.startsWith("package:")) {
          logger.info("[OpenURL] Detected package URL, extracting package name");
          const packageName = trimmedUrl.replace("package:", "");
    
          if (!packageName) {
            logger.error("[OpenURL] No package name found in package URL");
            return {
              success: false,
              url: trimmedUrl,
              error: "Invalid package URL - no package name specified"
            };
          }
    
          logger.info(`[OpenURL] Launching app with package name: ${packageName}`);
    
          try {
            // Use LaunchApp to properly launch the application
            const launchApp = new LaunchApp(this.device, this.adb);
            const launchResult = await launchApp.execute(packageName, false, true);
    
            if (launchResult.success) {
              logger.info(`[OpenURL] Successfully launched app ${packageName}`);
              return {
                success: true,
                url: trimmedUrl
              };
            } else {
              logger.error(`[OpenURL] Failed to launch app ${packageName}: ${launchResult.error}`);
              return {
                success: false,
                url: trimmedUrl,
                error: `Failed to launch app: ${launchResult.error}`
              };
            }
          } catch (error) {
            logger.error(`[OpenURL] Exception while launching app ${packageName}:`, error);
            return {
              success: false,
              url: trimmedUrl,
              error: `Failed to launch app: ${error}`
            };
          }
        }
    
        // Handle regular URLs (http, https, mailto, tel, etc.)
        logger.info(`[OpenURL] Processing as regular URL: ${trimmedUrl}`);
    
        return this.observedInteraction(
          async () => {
            // Platform-specific URL opening execution
            switch (this.device.platform) {
              case "android":
                return await this.executeAndroidOpenURL(url);
              case "ios":
                return await this.executeiOSOpenURL(url);
              default:
                throw new Error(`Unsupported platform: ${this.device.platform}`);
            }
          },
          {
            changeExpected: false,
            timeoutMs: 12000
          }
        );
      }
    
      /**
       * Execute Android-specific URL opening
       * @param url - URL to open
       * @returns Result of the URL opening operation
       */
      private async executeAndroidOpenURL(url: string): Promise<OpenURLResult> {
        await this.adb.executeCommand(`shell am start -a android.intent.action.VIEW -d "${url}"`);
    
        return {
          success: true,
          url
        };
      }
    
      /**
       * Execute iOS-specific URL opening
       * @param url - URL to open
       * @returns Result of the URL opening operation
       */
      private async executeiOSOpenURL(url: string): Promise<OpenURLResult> {
        await this.axe.openUrl(url);
    
        return {
          success: true,
          url
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action but doesn't cover critical aspects like whether this requires specific permissions, if it's synchronous/asynchronous, potential errors (e.g., invalid URLs), or side effects (e.g., opening a browser window). This is inadequate for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is a single, clear sentence that front-loads the essential action without any waste. It's appropriately sized for a simple tool, making it easy for an agent to parse quickly.

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 (2 parameters, no output schema, no annotations), the description is minimally complete but lacks depth. It covers the basic purpose but misses behavioral details and usage context, which are important for a tool that interacts with system browsers and devices. It's adequate but has clear gaps.

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

Parameters3/5

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

The schema description coverage is 100%, so the schema already documents both parameters ('url' and 'platform') with descriptions and an enum for 'platform'. The description adds no additional semantic meaning beyond what's in the schema, such as explaining why 'platform' is required or providing examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('Open') and resource ('a URL in the default browser'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'launchApp' or 'getDeepLinks', which might have overlapping browser-related functionality, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't specify if this is for testing web links, launching apps via URLs, or other contexts, nor does it mention prerequisites like needing a browser installed. This lack of context leaves the agent to infer usage.

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/zillow/auto-mobile'

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