search_app
Search for apps on iOS and Android app stores by term, platform, and region to find relevant applications and their details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | The search term to look up (e.g., 'panda', 'spotify', 'photo editor'). This is required. | |
| platform | Yes | The platform to search on ('ios' for Apple App Store, 'android' for Google Play Store). | |
| num | No | Number of results to return (1-250, default 10). For Android max is 250, for iOS typically defaults to 50. | |
| country | No | Two-letter country code for the App Store/Play Store region (e.g., 'us', 'de', 'gb'). Affects ranking and availability. Default 'us'. | us |
Implementation Reference
- server.js:66-142 (handler)The core handler function for the 'search_app' tool. It takes search parameters, queries the appropriate store API (Google Play via gplay or App Store via app-store-scraper), standardizes the app results across platforms, and returns formatted JSON with search results or error information.async ({ term, platform, num, country }) => { try { let results; if (platform === "android") { // Search on Google Play Store results = await memoizedGplay.search({ term, num, country, fullDetail: false }); // Standardize the results results = results.map(app => ({ id: app.appId, appId: app.appId, title: app.title, developer: app.developer, developerId: app.developerId, icon: app.icon, score: app.score, scoreText: app.scoreText, price: app.price, free: app.free, platform: "android", url: app.url })); } else { // Search on Apple App Store results = await memoizedAppStore.search({ term, num, country }); // Standardize the results results = results.map(app => ({ id: app.id.toString(), appId: app.appId, title: app.title, developer: app.developer, developerId: app.developerId, icon: app.icon, score: app.score, price: app.price, free: app.free === true, platform: "ios", url: app.url })); } return { content: [{ type: "text", text: JSON.stringify({ query: term, platform, results, count: results.length }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: error.message, query: term, platform }, null, 2) }], isError: true }; } }
- server.js:60-65 (schema)Zod input schema defining parameters for the search_app tool: term (required string), platform (ios/android), num (optional number 1-250 default 10), country (optional 2-letter code default 'us'). Validates and types tool arguments.{ term: z.string().describe("The search term to look up (e.g., 'panda', 'spotify', 'photo editor'). This is required."), platform: z.enum(["ios", "android"]).describe("The platform to search on ('ios' for Apple App Store, 'android' for Google Play Store)."), num: z.number().min(1).max(250).optional().default(10).describe("Number of results to return (1-250, default 10). For Android max is 250, for iOS typically defaults to 50."), country: z.string().length(2).optional().default("us").describe("Two-letter country code for the App Store/Play Store region (e.g., 'us', 'de', 'gb'). Affects ranking and availability. Default 'us'.") },
- server.js:58-143 (registration)The registration of the 'search_app' tool on the McpServer instance using server.tool(name, inputSchema, handlerCallback). This adds the tool to the MCP server's capabilities.server.tool( "search_app", { term: z.string().describe("The search term to look up (e.g., 'panda', 'spotify', 'photo editor'). This is required."), platform: z.enum(["ios", "android"]).describe("The platform to search on ('ios' for Apple App Store, 'android' for Google Play Store)."), num: z.number().min(1).max(250).optional().default(10).describe("Number of results to return (1-250, default 10). For Android max is 250, for iOS typically defaults to 50."), country: z.string().length(2).optional().default("us").describe("Two-letter country code for the App Store/Play Store region (e.g., 'us', 'de', 'gb'). Affects ranking and availability. Default 'us'.") }, async ({ term, platform, num, country }) => { try { let results; if (platform === "android") { // Search on Google Play Store results = await memoizedGplay.search({ term, num, country, fullDetail: false }); // Standardize the results results = results.map(app => ({ id: app.appId, appId: app.appId, title: app.title, developer: app.developer, developerId: app.developerId, icon: app.icon, score: app.score, scoreText: app.scoreText, price: app.price, free: app.free, platform: "android", url: app.url })); } else { // Search on Apple App Store results = await memoizedAppStore.search({ term, num, country }); // Standardize the results results = results.map(app => ({ id: app.id.toString(), appId: app.appId, title: app.title, developer: app.developer, developerId: app.developerId, icon: app.icon, score: app.score, price: app.price, free: app.free === true, platform: "ios", url: app.url })); } return { content: [{ type: "text", text: JSON.stringify({ query: term, platform, results, count: results.length }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: error.message, query: term, platform }, null, 2) }], isError: true }; } } );