Source code for folderbot.tools.web_search

"""Web search tool using Google Custom Search API."""

import logging

import httpx
from pydantic import BaseModel, Field

from ..bot import BotContext
from .base import ToolResult
from .registry import folder_bot, get_services, get_tool_config

logger = logging.getLogger(__name__)

GOOGLE_SEARCH_URL = "https://www.googleapis.com/customsearch/v1"


[docs] class WebSearchRequest(BaseModel, frozen=True): """Request for searching the web.""" query: str = Field(description="Search query to look up on the web") max_results: int = Field( default=5, description="Maximum number of search results to return (1-10)", )
[docs] def is_available() -> bool: """Check if web search is available (always True — uses httpx which is a core dep).""" return True