Skip to main content
Glama

open_app

Launch an Android app directly by specifying its package name using ADB commands. Ideal for automation, testing, and device management without manual navigation.

Instructions

Open an app using its package name and activity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesFull package name of the app (e.g., com.example.app)

Implementation Reference

  • The asynchronous handler function for the 'open_app' tool. It extracts the package_name from arguments, launches the app using 'adb shell monkey', waits 5 seconds with sleep, and returns a textual success message.
    open_app: async (args: any) => { const { package_name } = args as { package_name: string; }; await executeCommand(`adb shell monkey -p ${package_name} 1`); await sleep(5000); return { content: [ { type: 'text', text: `App opened: ${package_name}`, }, ], }; },
  • The input schema definition for the 'open_app' tool within the toolDefinitions array, defining the required 'package_name' parameter.
    { name: 'open_app', description: 'Open an app using its package name and activity', inputSchema: { type: 'object', properties: { package_name: { type: 'string', description: 'Full package name of the app (e.g., com.example.app)', }, }, required: ['package_name'], }, },
  • src/index.ts:26-30 (registration)
    Registration of the ListTools request handler, which returns the toolDefinitions array including the 'open_app' tool schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });
  • src/index.ts:32-46 (registration)
    Registration of the CallTool request handler, which dynamically invokes the handler from toolHandlers based on tool name, enabling execution of 'open_app'.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const handler = toolHandlers[name as keyof typeof toolHandlers]; if (!handler) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } return await handler(args); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`); } });
  • src/index.ts:11-12 (registration)
    Imports of toolDefinitions and toolHandlers used for registering the 'open_app' tool.
    import { toolDefinitions } from './tools/definitions.js'; import { toolHandlers } from './tools/handlers.js';

Other Tools

Related 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/TiagoDanin/Android-Debug-Bridge-MCP'

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