Skip to main content
Glama

getDeepLinks

Retrieve deep links and intent filters for Android apps by specifying the app package ID. Simplifies app navigation and automation testing within AutoMobile.

Instructions

Query available deep links and intent filters for an Android application

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesAndroid app package ID to query for deep links

Implementation Reference

  • The main tool handler for getDeepLinks: creates GetDeepLinks instance, executes it with appId, formats JSON response with deep link results
    const getDeepLinksHandler = async (device: BootedDevice, args: GetDeepLinksArgs) => { try { const getDeepLinks = new GetDeepLinks(device); const result = await getDeepLinks.execute(args.appId); return createJSONToolResponse({ message: `Discovered deep links for app ${args.appId}`, success: result.success, appId: result.appId, schemes: result.deepLinks.schemes, hosts: result.deepLinks.hosts, intentFilters: result.deepLinks.intentFilters, supportedMimeTypes: result.deepLinks.supportedMimeTypes, error: result.error, rawOutput: result.rawOutput }); } catch (error) { logger.error(`[getDeepLinks] Failed to get deep links: ${error}`); throw new ActionableError(`Failed to get deep links: ${error}`); } };
  • Zod schema defining input args for getDeepLinks tool (appId: string)
    export const getDeepLinksSchema = z.object({ appId: z.string().describe("Android app package ID to query for deep links"), });
  • Registration of the getDeepLinks tool in ToolRegistry with name, description, schema, and handler
    ToolRegistry.registerDeviceAware( "getDeepLinks", "Query available deep links and intent filters for an Android application", getDeepLinksSchema, getDeepLinksHandler, false // Does not support progress notifications );
  • GetDeepLinks class execute method: validates appId, calls DeepLinkManager.getDeepLinks, handles errors and logging
    async execute(appId: string): Promise<DeepLinkResult> { try { logger.info(`[GetDeepLinks] Starting deep link discovery for app: ${appId}`); if (!appId || appId.trim().length === 0) { throw new Error("App ID cannot be empty"); } const result = await this.deepLinkManager.getDeepLinks(appId); logger.info(`[GetDeepLinks] Deep link discovery completed for ${appId}. Found ${result.deepLinks.schemes.length} schemes and ${result.deepLinks.hosts.length} hosts`); return result; } catch (error) { logger.error(`[GetDeepLinks] Failed to get deep links for ${appId}: ${error}`); return { success: false, appId, deepLinks: { schemes: [], hosts: [], intentFilters: [], supportedMimeTypes: [] }, error: error instanceof Error ? error.message : String(error) }; }
  • Core implementation in DeepLinkManager.getDeepLinks: executes adb dumpsys package command and parses output for schemes, hosts, intent filters, mime types
    async getDeepLinks(appId: string): Promise<DeepLinkResult> { try { logger.info(`[DeepLinkManager] Querying deep links for app: ${appId}`); // Use dumpsys package to get detailed package information including intent filters const packageInfoResult = await this.adbUtils.executeCommand( `shell dumpsys package ${appId}` ); // Parse the results const deepLinks = this.parsePackageDumpsysOutput(appId, packageInfoResult.stdout); return { success: true, appId, deepLinks, rawOutput: packageInfoResult.stdout }; } catch (error) { logger.error(`[DeepLinkManager] Failed to get deep links for ${appId}: ${error}`); return { success: false, appId, deepLinks: { schemes: [], hosts: [], intentFilters: [], supportedMimeTypes: [] }, error: error instanceof Error ? error.message : String(error) }; } }

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