bing_search
Scrape and parse Bing search results with customizable geolocation, locale, device type, and pagination options.
Instructions
Scrape Bing Search results with automatic parsing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for Bing (e.g., "laptop") | |
| geo | No | Geolocation of the desired request, expressed as a country name | |
| locale | No | Locale of the desired request | |
| jsRender | No | Should the request be opened in a headless browser, false by default | |
| domain | No | Bing domain (e.g., bing.com, bing.co.uk) | |
| deviceType | No | Device type to emulate for the request | |
| pageFrom | No | Starting page number for pagination |
Implementation Reference
- The BingSearchTool class that implements the tool logic. The register() method (lines 31-71) contains the actual handler: it calls sapiClient.scrape() with target SCRAPER_API_TARGETS.BING_SEARCH, transforms the response by removing 'url' fields to reduce character count, and returns the scraped Bing search results as text content.
export class BingSearchTool extends Tool { toolset = TOOLSET.SEARCH; private static FIELDS_WITH_HIGH_CHAR_COUNT = ['url']; transformResponse = ({ data }: { data: object }) => { for (const fieldToRemove of BingSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT) { data = removeKeyFromNestedObject({ obj: data, keyToRemove: fieldToRemove }); } return { data: JSON.stringify(data) }; }; register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'bing_search', { description: 'Scrape Bing Search results with automatic parsing', inputSchema: { query: z.string().describe('Search query for Bing (e.g., "laptop")'), geo: zodGeo, locale: zodLocale, 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.BING_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 registration for 'bing_search'. Defines the input parameters: query (string), geo, locale, jsRender, domain (optional Bing domain), deviceType, and pageFrom (optional pagination start page). Annotations mark the tool as readOnlyHint and openWorldHint.
register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'bing_search', { description: 'Scrape Bing Search results with automatic parsing', inputSchema: { query: z.string().describe('Search query for Bing (e.g., "laptop")'), geo: zodGeo, locale: zodLocale, jsRender: zodJsRender, domain: zodDomain, deviceType: zodDeviceType, pageFrom: zodPageFrom, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, - src/server/sapi-base-server.ts:11-11 (registration)Import of BingSearchTool in the server file.
BingSearchTool, - src/server/sapi-base-server.ts:94-94 (registration)BingSearchTool is instantiated and added to allTools array. It gets registered via tool.register() in registerAllTools() or registerTools() depending on toolset filtering.
new BingSearchTool(), - src/constants.ts:44-44 (helper)Enum value BING_SEARCH = 'bing_search' in SCRAPER_API_TARGETS enum, used as the target parameter when making the scraping API call.
BING_SEARCH = 'bing_search',