search_book
Search for book information on Naver using keywords, with options to navigate pages and customize display settings for targeted results.
Instructions
Searches for book information on Naver using the given keyword. The page parameter allows for page navigation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| display | No | ||
| page | No | ||
| sort | No | sim |
Implementation Reference
- server.py:403-416 (handler)The async handler function that implements the core logic for the 'search_book' tool by calculating pagination parameters and calling the shared _make_api_call helper to query the Naver book search API.async def search_book(query: str, display: int = 10, page: int = 1, sort: str = "sim") -> str: """ Searches for book information on Naver using the given keyword. The page parameter allows for page navigation. Args: query (str): The keyword to search for display (int, optional): The number of results to display. Default is 10. page (int, optional): The starting page number. Default is 1. sort (str, optional): The sorting criteria. Default is "sim" (similarity). """ start = calculate_start(page, display) display = min(display, 100) params = {"query": query, "display": display, "start": start, "sort": sort} return await _make_api_call("book.json", params, BookResult, "Book")
- server.py:399-402 (registration)MCP tool registration decorator that binds the search_book handler function to the tool name 'search_book'.@mcp.tool( name="search_book", description="Searches for book information on Naver using the given keyword. The page parameter allows for page navigation." )
- server.py:68-77 (schema)Pydantic schema/model defining the fields for individual book items returned from the Naver book search API.class BookItem(BaseItem): image: Optional[str] = None author: Optional[str] = None price: Optional[str] = None discount: Optional[str] = None publisher: Optional[str] = None pubdate: Optional[str] = None isbn: Optional[str] = None description: Optional[str] = None
- server.py:129-129 (schema)Pydantic schema/model for the complete book search response, inheriting from SearchResultBase and specifying items as List[BookItem]. Used for input validation and parsing in _make_api_call.class BookResult(SearchResultBase): items: List[BookItem]