list_apps
Find installed Android applications by searching for specific name patterns in app packages to identify and manage apps on connected devices.
Instructions
List installed apps matching a name pattern
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_name | Yes | Name pattern to search for in app packages |
Implementation Reference
- src/tools/handlers.ts:65-77 (handler)The main handler function for the 'list_apps' tool. It takes an 'app_name' argument, runs an ADB command to list matching packages using 'pm list packages | findstr', and returns the result as a text content block.list_apps: async (args: any) => { const { app_name } = args as { app_name: string }; const result = await executeCommand(`adb shell pm list packages | findstr "${app_name}"`); return { content: [ { type: 'text', text: result || 'No apps found matching the pattern', }, ], }; },
- src/tools/definitions.ts:17-29 (schema)The JSON schema definition for the 'list_apps' tool, specifying the required 'app_name' string input.name: 'list_apps', description: 'List installed apps matching a name pattern', inputSchema: { type: 'object', properties: { app_name: { type: 'string', description: 'Name pattern to search for in app packages', }, }, required: ['app_name'], }, },
- src/index.ts:32-46 (registration)The MCP server request handler for calling tools (CallToolRequestSchema), which dispatches to the specific tool handler like 'list_apps' based on the name.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:26-30 (registration)The MCP server request handler for listing tools (ListToolsRequestSchema), which returns all tool definitions including 'list_apps'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });