Skip to main content
Glama

deep_link

Open any URL or deep link in a mobile app on iOS and Android to verify navigation and functionality.

Instructions

Ouvre une URL ou un deep link dans l'app (ex: myapp://profile, https://example.com). Fonctionne sur iOS et Android.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL ou deep link à ouvrir (ex: myapp://home, https://example.com/page)

Implementation Reference

  • The registerDeepLink function registers the 'deep_link' tool on the MCP server. The handler resolves the active device, validates the URL format, then dispatches to iosOpenUrl (via simctl) or androidOpenUrl (via adb) based on platform. Results are logged and returned as text content.
    export function registerDeepLink(server: McpServer): void {
      server.tool(
        "deep_link",
        "Ouvre une URL ou un deep link dans l'app (ex: myapp://profile, https://example.com). Fonctionne sur iOS et Android.",
        {
          url: z.string().describe("URL ou deep link à ouvrir (ex: myapp://home, https://example.com/page)"),
        },
        async ({ url }) => {
          const result = await resolveDevice();
          if ("error" in result) return { content: [{ type: "text", text: result.error }], isError: true };
          const dev = result.device;
    
          try {
            validateUrl(url);
    
            if (dev.platform === "ios") {
              await iosOpenUrl(dev.id, url);
            } else {
              await androidOpenUrl(url);
            }
    
            const platform = dev.platform === "ios" ? "🍎" : "🤖";
            const successMsg = `${platform} URL ouverte : ${url}`;
            logAction("deep_link", successMsg, false, dev.platform, dev.id, dev.name);
            return { content: [{ type: "text", text: successMsg }] };
          } catch (err) {
            const msg = err instanceof Error ? err.message : String(err);
            logAction("deep_link", `Erreur: ${msg}`, true, dev.platform, dev.id, dev.name);
            return { content: [{ type: "text", text: `Erreur deep_link: ${msg}` }], isError: true };
          }
        }
      );
    }
  • URL validation: regex check (scheme://path format), max length 2048 chars, and control character rejection. Used by the handler before dispatching to platform tools.
    const URL_REGEX = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\S+$/;
    
    function validateUrl(url: string): void {
      if (url.length > 2048) throw new Error("URL trop longue (max 2048 caractères).");
      if (/[\x00-\x1F\x7F]/.test(url)) throw new Error("URL contient des caractères de contrôle invalides.");
      if (!URL_REGEX.test(url)) throw new Error(`URL invalide : "${url}". Format attendu : scheme://path (ex: https://example.com, myapp://home)`);
    }
  • iOS implementation: runs 'xcrun simctl openurl <udid> <url>' to open a deep link on an iOS simulator. Validates UDID and URL before execution.
    export async function iosOpenUrl(deviceUdid: string, url: string): Promise<void> {
      validateUdid(deviceUdid);
      if (/[\x00-\x1F\x7F]/.test(url)) throw new Error("URL contient des caractères de contrôle.");
      if (url.startsWith("-")) throw new Error("URL invalide : ne peut pas commencer par \"-\".");
      await simctl(["openurl", deviceUdid, url]);
    }
  • Android implementation: uses 'adb shell am start -a android.intent.action.VIEW -d <url>' to open a deep link. Validates URL to prevent intent flag injection.
    export async function androidOpenUrl(url: string): Promise<void> {
      // Validate URL to prevent intent flag injection (url starting with "-" would be parsed as a flag by am)
      if (url.startsWith("-")) throw new Error(`URL invalide : ne peut pas commencer par "-".`);
      if (/[\x00-\x1F\x7F]/.test(url)) throw new Error("URL contient des caractères de contrôle.");
      await adb(["shell", "am", "start", "-a", "android.intent.action.VIEW", "-d", url]);
    }
  • src/index.ts:54-55 (registration)
    Tool registration: registerDeepLink(server) is called in the Navigation section of the main server setup, importing from ./tools/deep-link.js.
    // Navigation
    registerDeepLink(server);
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It only states it opens a URL/deep link, without mentioning potential side effects (e.g., app switching, permission requirements, or error handling). This is insufficient for an action that may change app state.

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 two sentences: first explains the action, second adds platform context. It is concise and front-loaded. No unnecessary words, though it could be slightly more structured.

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

Completeness4/5

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

Given the tool's simplicity (single parameter, no output schema), the description covers the essential purpose and platform compatibility. It does not explain return behavior or errors, but for a straightforward action this is acceptable.

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?

Schema coverage is 100% with description for the 'url' parameter. The description adds minimal extra meaning beyond the schema parameter description, repeating 'URL ou deep link'. Baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the action: 'Ouvre une URL ou un deep link dans l'app'. It specifies the resource (URL/deep link) and the verb (ouvre). The tool is distinct from siblings which focus on UI actions, testing, and device management.

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 mentions it works on iOS and Android but provides no guidance on when to use this tool versus alternatives like 'launch_app' or 'type_text'. No exclusions or prerequisite conditions are described.

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/nthImpulse/phantom-mcp'

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