walmart_search
Scrape Walmart product search results with automatic parsing. Accepts query, device type, delivery ZIP, and store ID for localized output.
Instructions
Scrape Walmart Search results with automatic parsing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for Walmart products (e.g., "camping tent") | |
| jsRender | No | Should the request be opened in a headless browser, false by default | |
| deviceType | No | Device type to emulate for the request | |
| deliveryZip | No | ZIP code for delivery location | |
| storeId | No | Walmart store ID for local inventory |
Implementation Reference
- The async handler function that executes the Walmart Search tool logic. It takes scraping params, adds the WALMART_SEARCH target and markdown=true, calls sapiClient.scrape(), transforms the response, and returns text content.
async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.WALMART_SEARCH, markdown: 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/tools/walmart-search/walmart-search-tool.ts:31-68 (registration)The register() method on WalmartSearchTool that registers the tool with name 'walmart_search' including description, inputSchema (query, jsRender, deviceType, deliveryZip, storeId), annotations, and the async handler.
register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'walmart_search', { description: 'Scrape Walmart Search results with automatic parsing', inputSchema: { query: z.string().describe('Search query for Walmart products (e.g., "camping tent")'), jsRender: zodJsRender, deviceType: zodDeviceType, deliveryZip: zodDeliveryZip, storeId: zodWalmartStoreId, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.WALMART_SEARCH, markdown: 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 for walmart_search: query (string), jsRender, deviceType, deliveryZip (optional string), storeId (optional string).
inputSchema: { query: z.string().describe('Search query for Walmart products (e.g., "camping tent")'), jsRender: zodJsRender, deviceType: zodDeviceType, deliveryZip: zodDeliveryZip, storeId: zodWalmartStoreId, }, - transformResponse helper that strips high-character-count fields ('suggested', 'refinements') from the scraped data to reduce response size.
transformResponse = ({ data }: { data: object }) => { for (const fieldToRemove of WalmartSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT) { data = removeKeyFromNestedObject({ obj: data, keyToRemove: fieldToRemove }); } return { data: JSON.stringify(data) }; }; - src/server/sapi-base-server.ts:79-97 (registration)WalmartSearchTool is instantiated in the allTools array and registered via registerTools()/registerAllTools() which calls tool.register() on the MCP server.
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(), ];