gp_search
Search Google Play Store for apps using specific terms, countries, languages, and result counts to retrieve app data.
Instructions
[Google Play] Search for apps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | Search term | |
| country | No | Two-letter country code (default: us) | us |
| lang | No | Language code (default: en) | en |
| num | No | Number of results (default: 250) |
Implementation Reference
- src/server.js:571-607 (handler)Main execution handler for gp_search tool: validates input, builds Google Play search URL, fetches HTML, parses results, returns JSON response or error.async function handleGPSearch(args) { try { const { term, country = 'us', lang = 'en', num = 250, } = args; if (!term) { throw new Error('term is required'); } const url = buildGPSearchUrl({ term, country, lang, num }); const html = await fetchText(url); const result = parseGPSearch(html); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ error: error.message }, null, 2), }, ], isError: true, }; } }
- src/server.js:1208-1232 (schema)Input schema defining parameters for gp_search: term (required string), country, lang, num with defaults.inputSchema: { type: 'object', properties: { term: { type: 'string', description: 'Search term', }, country: { type: 'string', description: 'Two-letter country code (default: us)', default: 'us', }, lang: { type: 'string', description: 'Language code (default: en)', default: 'en', }, num: { type: 'number', description: 'Number of results (default: 250)', default: 250, }, }, required: ['term'], },
- src/server.js:1468-1469 (registration)Dispatch registration in CallToolRequestSchema switch statement routing 'gp_search' to handleGPSearch.case 'gp_search': return await handleGPSearch(args);
- src/endpoints/googlePlay.js:14-31 (helper)Helper function buildSearchUrl (aliased as buildGPSearchUrl) constructs the Google Play search endpoint URL.export function buildSearchUrl(params) { const { term, country = 'us', lang = 'en', num = 250, fullDetail = false, } = params; const queryParams = new URLSearchParams({ q: term, c: 'apps', gl: country, hl: lang, }); return `${GOOGLE_PLAY_BASE}/store/search?${queryParams.toString()}`; }
- Helper parser parseSearchResults (aliased as parseGPSearch) wraps parseSearch to return structured results with count.export function parseSearchResults(html) { const apps = parseSearch(html); return { results: apps, count: apps.length, }; }