amazon_search
Scrapes and parses Amazon search results automatically. Customize by location, domain, device, and pagination.
Instructions
Scrape Amazon Search results with automatic parsing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for Amazon products (e.g., "wireless keyboard") | |
| geo | No | Geolocation of the desired request, expressed as a country name | |
| jsRender | No | Should the request be opened in a headless browser, false by default | |
| domain | No | Amazon domain (e.g., amazon.com, amazon.co.uk) | |
| deviceType | No | Device type to emulate for the request | |
| pageFrom | No | Starting page number for pagination |
Implementation Reference
- The core handler function for amazon_search tool. It constructs scraper API params with the AMAZON_SEARCH target and parse=true, calls the ScraperApiClient, transforms the response (removing high-char-count fields like 'suggested', 'amazons_choices', 'refinements'), and returns the result as text content.
async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.AMAZON_SEARCH, parse: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); const { data: text } = this.transformResponse({ data }); return { content: [ { type: 'text', text, }, ], }; } - Input schema (validation/Zod definitions) for the amazon_search tool: query (required string), geo, jsRender, domain, deviceType, pageFrom (all optional). Defined inline within the register method.
inputSchema: { query: z.string().describe('Search query for Amazon products (e.g., "wireless keyboard")'), geo: zodGeo, jsRender: zodJsRender, domain: zodDomain, deviceType: zodDeviceType, pageFrom: zodPageFrom, }, annotations: { readOnlyHint: true, openWorldHint: true, }, - Local Zod schemas for 'domain' (string) and 'pageFrom' (number), used in the input schema.
const zodDomain = z .string() .describe('Amazon domain (e.g., amazon.com, amazon.co.uk)') .optional(); const zodPageFrom = z .number() .describe('Starting page number for pagination') .optional(); - src/tools/amazon-search/amazon-search-tool.ts:31-70 (registration)Registration of the 'amazon_search' tool via server.registerTool() with the name, description, input schema (with annotations), and the handler callback.
register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'amazon_search', { description: 'Scrape Amazon Search results with automatic parsing', inputSchema: { query: z.string().describe('Search query for Amazon products (e.g., "wireless keyboard")'), geo: zodGeo, jsRender: zodJsRender, domain: zodDomain, deviceType: zodDeviceType, pageFrom: zodPageFrom, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.AMAZON_SEARCH, parse: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); const { data: text } = this.transformResponse({ data }); return { content: [ { type: 'text', text, }, ], }; } ); }; - src/server/sapi-base-server.ts:66-97 (registration)Registration of AmazonSearchTool in the static allTools array on the ScraperAPIBaseServer class, which is iterated during tool registration.
static allTools: Tool[] = [ new ScrapeAsMarkdownTool(), new ScreenshotTool(), new GoogleSearchTool(), new GoogleAdsTool(), new GoogleLensTool(), new GoogleAiModeTool(), new GoogleTravelHotelsTool(), new AmazonSearchTool(), new AmazonProductTool(), new AmazonPricingTool(), new AmazonSellersTool(), new AmazonBestsellersTool(), new WalmartSearchTool(), new WalmartProductTool(), new TargetSearchTool(), new TargetProductTool(), new TiktokPostTool(), new TiktokShopSearchTool(), new TiktokShopProductTool(), new TiktokShopUrlTool(), new YoutubeMetadataTool(), new YoutubeChannelTool(), new YoutubeSubtitlesTool(), new YoutubeSearchTool(), new RedditPostTool(), new RedditSubredditTool(), new RedditUserTool(), new BingSearchTool(), new ChatGPTTool(), new PerplexityTool(), ];