crawl_google_suggest
Collect Google search suggestions for keywords in Korea, US, or Japan to analyze search trends and user queries.
Instructions
입력된 키워드에 대해 구글 서제스트에 나타난 키워드 수집 요청
args:
keyword: str, 키워드
gl: Literal['kr', 'us', 'jp'] = "kr", 국가 코드
returns:
dict[Any] | None: 구글 서제스트 수집 결과
키워드 suggestions
한국 (gl: kr)
미국 (gl: us)
일본 (gl: jp)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | ||
| gl | No | kr |
Implementation Reference
- data_api.py:425-453 (handler)The handler function that implements the core logic of the 'crawl_google_suggest' tool. It sends a POST request to the Hubble API's /google_suggest endpoint with the query 'q' and geolocation 'gl', returning the response text.async def crawl_google_suggest( q: str, gl: Literal['kr', 'us', 'jp'] = "kr") -> dict[Any] | None: ''' 입력된 키워드에 대해 구글 서제스트에 나타난 키워드 수집 요청 args: keyword: str, 키워드 gl: Literal['kr', 'us', 'jp'] = "kr", 국가 코드 returns: dict[Any] | None: 구글 서제스트 수집 결과 키워드 suggestions 한국 (gl: kr) 미국 (gl: us) 일본 (gl: jp) ''' async with httpx.AsyncClient() as client: payload = { "q": q, "gl": gl, } headers = {"X-API-Key": HUBBLE_API_KEY} response = await client.post( f"{HUBBLE_API_URL}/google_suggest", headers=headers, json=payload, timeout=30.0) response.raise_for_status() return response.text
- data_api.py:424-424 (registration)The @mcp.tool() decorator registers the crawl_google_suggest function as a tool in the FastMCP server. The @async_retry decorator adds retry logic.@async_retry(exceptions=(Exception), tries=2, delay=0.3)