search_local
Find local businesses using keywords, with options to sort results by random or comment count and control display parameters.
Instructions
Searches for local business information using the given keyword. (display maximum 5, start maximum 1) sort='random'/'comment' is supported.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| display | No | ||
| page | No | ||
| sort | No | random |
Implementation Reference
- server.py:498-511 (handler)The handler function that implements the core logic of the 'search_local' tool by preparing parameters and calling the shared Naver Local API via _make_api_call.async def search_local(query: str, display: int = 5, page: int = 1, sort: str = "random") -> str: """ Searches for local business information using the given keyword. (display maximum 5, start maximum 1) sort='random'/'comment' is supported. Args: query (str): The keyword to search for display (int, optional): The number of results to display. Default is 5. page (int, optional): The starting page number. Default is 1. sort (str, optional): The sorting criteria. Default is "random" (random). """ display = min(display, 5) # API 제약 조건 적용 start = 1 # 지역 API는 항상 start=1 params = {"query": query, "display": display, "start": start, "sort": sort} return await _make_api_call("local.json", params, LocalResult, "Local")
- server.py:494-497 (registration)The @mcp.tool decorator that registers the 'search_local' tool with MCP, specifying its name and description.@mcp.tool( name="search_local", description="Searches for local business information using the given keyword. (display maximum 5, start maximum 1) sort='random'/'comment' is supported." )
- server.py:97-104 (schema)Pydantic schema/model for individual local search result items, defining fields like category, address, telephone, etc.class LocalItem(BaseItem): category: Optional[str] = None description: Optional[str] = None telephone: Optional[str] = None address: Optional[str] = None roadAddress: Optional[str] = None mapx: Optional[str] = None mapy: Optional[str] = None
- server.py:132-132 (schema)Pydantic schema for the overall Local search result, inheriting from SearchResultBase with items as List[LocalItem].class LocalResult(SearchResultBase): items: List[LocalItem]