google_travel_hotels
Scrape hotel search results from Google Travel. Enter a query like 'hotels in Paris' to retrieve data with options for pagination, locale, and device type.
Instructions
Scrape Google Travel Hotels search results
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Hotel search query (e.g., "trivago", "hotels in Paris") | |
| jsRender | No | Should the request be opened in a headless browser, false by default | |
| locale | No | Locale of the desired request | |
| deviceType | No | Device type to emulate for the request | |
| pageFrom | No | Starting page number for pagination |
Implementation Reference
- The async handler function that executes the tool logic. It receives scraping parameters, adds the target 'google_travel_hotels' and markdown: true, calls sapiClient.scrape(), and returns the result as text content.
async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.GOOGLE_TRAVEL_HOTELS, markdown: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } - Input schema for the tool. Defines required 'query' (string), and optional fields: jsRender, locale, deviceType, pageFrom.
description: 'Scrape Google Travel Hotels search results', inputSchema: { query: z.string().describe('Hotel search query (e.g., "trivago", "hotels in Paris")'), jsRender: zodJsRender, locale: zodLocale, deviceType: zodDeviceType, pageFrom: zodPageFrom, }, - The register method that calls server.registerTool() with the name 'google_travel_hotels', the input schema, annotations, and the async handler.
register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'google_travel_hotels', { description: 'Scrape Google Travel Hotels search results', inputSchema: { query: z.string().describe('Hotel search query (e.g., "trivago", "hotels in Paris")'), jsRender: zodJsRender, locale: zodLocale, deviceType: zodDeviceType, pageFrom: zodPageFrom, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.GOOGLE_TRAVEL_HOTELS, markdown: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } ); }; - src/server/sapi-base-server.ts:73-73 (registration)Instantiation of GoogleTravelHotelsTool in the allTools array, making it available for registration on the MCP server.
new GoogleTravelHotelsTool(), - src/constants.ts:11-12 (helper)Enum constant SCRAPER_API_TARGETS.GOOGLE_TRAVEL_HOTELS = 'google_travel_hotels' used by the handler to set the scrape target.
GOOGLE_SEARCH = 'google_search', GOOGLE_TRAVEL_HOTELS = 'google_travel_hotels',