check_adult_query
Identify adult content in search queries to filter inappropriate results and maintain safe search environments.
Instructions
Determines if the input query is an adult search term.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:423-432 (handler)The main handler function for the 'check_adult_query' tool. It takes a query string, calls the shared _make_api_call helper with the Naver adult check endpoint, and returns a formatted string result.
async def check_adult_query(query: str) -> str: """ Determines if the input query is an adult search term. Args: query (str): The keyword to search for """ params = {"query": query} return await _make_api_call("adult.json", params, AdultResult, "Adult Search Term") - server.py:111-111 (schema)Pydantic BaseModel defining the output schema for the adult query check API response, with a single 'adult' field (likely 0 or 1 indicating if it's adult content).
class AdultResult(BaseModel): adult: str - server.py:419-422 (registration)MCP decorator that registers the 'check_adult_query' tool, specifying its name and description. The input schema is inferred from the function signature (query: str).
@mcp.tool( name="check_adult_query", description="Determines if the input query is an adult search term." ) - server.py:303-308 (helper)Specific handling logic within the shared _make_api_call helper function for formatting AdultResult responses into Korean text ("일반 검색어" or "성인 검색어"). This is called by the handler.
elif isinstance(result, AdultResult): prompt_string = f"네이버 {search_type_name} 확인 결과:" if result.adult == 0: return f"{prompt_string} 일반 검색어" else: return f"{prompt_string} 성인 검색어"