get_area_codes
Retrieve area codes for Korean regions to identify provinces, cities, and districts for tourism planning. Supports multiple languages and hierarchical navigation.
Instructions
Get area codes for regions in Korea.
This tool retrieves area codes and their corresponding names for Korean regions. It can be used to get top-level area codes (provinces/cities) or sub-area codes (districts/counties) within a specific area.
Args: parent_area_code (str, optional): Parent area code to get sub-areas - If None: Returns top-level area codes (provinces/cities) - If provided: Returns sigungu codes for that area language (str, optional): Language for results (default: "en"). Supported: - "en" (English) - "jp" (Japanese) - "zh-cn" (Simplified Chinese) - "zh-tw" (Traditional Chinese) - "de" (German) - "fr" (French) - "es" (Spanish) - "ru" (Russian) page (int, optional): Page number for pagination (default: 1, min: 1) rows (int, optional): Number of items per page (default: 100, max: 100)
Returns: dict: Area codes with structure: { "total_count": int, # Total number of matching items "parent_area_code": str, # Parent area code used (or null) "items": [ # List of area code items { "code": str, # Area code value "name": str, # Area name "rnum": str # Row number } # ... more items ] }
Available area codes: - "1" (Seoul) - "2" (Incheon) - "3" (Daejeon) - "4" (Daegu) - "5" (Gwangju) - "6" (Busan) - "7" (Ulsan) - "8" (Sejong) - "31" (Gyeonggi-do) - "32" (Gangwon-do) - "33" (Chungcheongbuk-do) - "34" (Chungcheongnam-do) - "35" (Gyeongsangbuk-do) - "36" (Gyeongsangnam-do) - "37" (Jeonbuk-do) - "38" (Jeollanam-do) - "39" (Jeju-do)
Example: get_area_codes(None, "en", 1, 50) # Get top-level areas get_area_codes("1", "en", 1, 50) # Get districts in Seoul
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent_area_code | No | ||
| language | No | ||
| page | No | ||
| rows | No |
Implementation Reference
- src/mcp_tourism/server.py:940-1013 (handler)The `get_area_codes` tool is registered using the `@mcp.tool` decorator and implemented as an asynchronous function. It retrieves area codes from the `KoreaTourismApiClient` and formats the response.
@mcp.tool async def get_area_codes( parent_area_code: str | None = None, language: str | None = None, page: int = 1, rows: int = 100, ) -> dict: """ Get area codes for regions in Korea. This tool retrieves area codes and their corresponding names for Korean regions. It can be used to get top-level area codes (provinces/cities) or sub-area codes (districts/counties) within a specific area. Args: parent_area_code (str, optional): Parent area code to get sub-areas - If None: Returns top-level area codes (provinces/cities) - If provided: Returns sigungu codes for that area language (str, optional): Language for results (default: "en"). Supported: - "en" (English) - "jp" (Japanese) - "zh-cn" (Simplified Chinese) - "zh-tw" (Traditional Chinese) - "de" (German) - "fr" (French) - "es" (Spanish) - "ru" (Russian) page (int, optional): Page number for pagination (default: 1, min: 1) rows (int, optional): Number of items per page (default: 100, max: 100) Returns: dict: Area codes with structure: { "total_count": int, # Total number of matching items "parent_area_code": str, # Parent area code used (or null) "items": [ # List of area code items { "code": str, # Area code value "name": str, # Area name "rnum": str # Row number } # ... more items ] } Available area codes: - "1" (Seoul) - "2" (Incheon) - "3" (Daejeon) - "4" (Daegu) - "5" (Gwangju) - "6" (Busan) - "7" (Ulsan) - "8" (Sejong) - "31" (Gyeonggi-do) - "32" (Gangwon-do) - "33" (Chungcheongbuk-do) - "34" (Chungcheongnam-do) - "35" (Gyeongsangbuk-do) - "36" (Gyeongsangnam-do) - "37" (Jeonbuk-do) - "38" (Jeollanam-do) - "39" (Jeju-do) Example: get_area_codes(None, "en", 1, 50) # Get top-level areas get_area_codes("1", "en", 1, 50) # Get districts in Seoul """ # Call the API client and return dict directly results = await get_api_client().get_area_code_list( area_code=parent_area_code, language=language, page=page, rows=rows ) # Add parent_area_code to the results return {**results, "parent_area_code": parent_area_code}