localSearch
Search for Korean locations and businesses using Naver's local service. Find places with customizable sorting and result display options.
Instructions
Searches for places registered with Naver's local service.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | query used for search | |
| display | No | number of search results to display in response | |
| sort | No | sorting method. random: sorted by correctness. comment: sorted by a number of reviews (descending) | random |
Implementation Reference
- src/mcp_naver_maps/server.py:45-63 (handler)MCP tool handler and registration for 'localSearch'. Includes input schema via Pydantic Fields, executes by calling NaverMapsClient helper, and handles errors.@mcp.tool(description="Searches for places registered with Naver's local service.") async def localSearch( query: str = Field(description="query used for search", min_length=1), display: int = Field( 5, description="number of search results to display in response", ge=0, le=5 ), sort: Literal["random", "comment"] = Field( "random", description="sorting method. random: sorted by correctness. comment: sorted by a number of reviews (descending)", ), ) -> LocalSearchResponse | Dict: """ Returns: LocalSearchResponse: An object containing places registered with Naver's local service. """ try: return await naver_maps_client.searchForLocalInformation(query, display, sort) except Exception as ex: return {"success": False, "error": str(ex)}
- src/mcp_naver_maps/models.py:36-40 (schema)Pydantic model defining the output schema for localSearch results.class LocalSearchResponse(BaseModel): total: int = Field(description="Total number of results") start: int = Field(description="Starting index of results") display: int = Field(description="Number of results displayed in the response") items: List[LocalItem] = Field(description="List of search result items")
- Helper function in NaverMapsClient that performs the actual API call to Naver's local search endpoint and parses the response into LocalSearchResponse.async def searchForLocalInformation( self, query: str, display: int = 5, sort: Literal["random", "comment"] = "random" ) -> LocalSearchResponse: """ https://developers.naver.com/docs/serviceapi/search/local/local.md#%EC%A7%80%EC%97%AD """ path = f"{self.SEARCH_BASE_URL}/local.json" params = { "query": query, "display": display, "sort": sort, } response_json = await self._get(path, self.naver_headers, params) return LocalSearchResponse(**response_json)
- src/mcp_naver_maps/models.py:27-34 (schema)Pydantic model for individual items in the LocalSearchResponse.class LocalItem(BaseModel): title: str = Field(description="Name of the place") link: str = Field(description="URL of the place") category: str = Field(description="Category of the place") description: str = Field(description="Brief description of the place") address: str = Field(description="Land-lot address") roadAddress: str = Field(description="Street address")