search_bunjang
Search Bunjang marketplace for secondhand items using keywords in Korean or English. Sort listings by recent or popular and control number of results (up to 100).
Instructions
Search Bunjang (번개장터) — Korea's largest C2C marketplace.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | Search keyword in Korean or English | |
| max_items | No | Maximum number of listings to return (default 30, max 100) | |
| sort | No | Sort order — 'recent' (최신순) or 'popular' (인기순) | recent |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/korean_data_mcp/server.py:147-168 (handler)Handler function for the 'search_bunjang' MCP tool. Runs the Bunjang marketplace scraper Apify actor with keyword, max_items, and sort parameters.
@mcp.tool() async def search_bunjang( keyword: str, max_items: int = 30, sort: str = "recent", ) -> list[dict]: """ Search Bunjang (번개장터) — Korea's largest C2C marketplace. Args: keyword: Search keyword in Korean or English max_items: Maximum number of listings to return (default 30, max 100) sort: Sort order — 'recent' (최신순) or 'popular' (인기순) Returns: List of listing objects with title, price, condition, seller, image, url fields. """ max_items = min(max_items, 100) return await _run_actor( f"{APIFY_ACCOUNT}/bunjang-market-scraper", {"keyword": keyword, "maxItems": max_items, "sort": sort}, ) - src/korean_data_mcp/server.py:147-147 (registration)Registration of 'search_bunjang' as an MCP tool via FastMCP's @mcp.tool() decorator.
@mcp.tool() - src/korean_data_mcp/server.py:34-43 (helper)Helper function that runs an Apify actor and returns dataset items. Used by search_bunjang to invoke the bunjang-market-scraper actor.
async def _run_actor(actor_id: str, input_data: dict, timeout_secs: int = 60) -> list[dict]: """Run an Apify actor synchronously and return dataset items.""" token = _get_token() url = f"{APIFY_BASE}/acts/{actor_id}/run-sync-get-dataset-items" params = {"token": token} async with httpx.AsyncClient(timeout=timeout_secs + 10) as client: resp = await client.post(url, json=input_data, params=params) resp.raise_for_status() return resp.json()