web_search
Search the web for information using natural language queries to find answers and data from across the internet.
Instructions
Search the web for information about the given query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- server.py:14-18 (handler)The web_search tool handler: decorated with @mcp.tool() for registration, defines input schema via type hints (query: str), executes web search using TavilyClient, and returns results as str.@mcp.tool() def web_search(query: str) -> str: """Search the web for information about the given query""" search_results = web_search_client.get_search_context(query=query) return search_results
- server.py:11-11 (helper)Helper: Initializes the TavilyClient instance used by the web_search handler, loading API key from environment.web_search_client = TavilyClient(os.getenv("TAVILY_API_KEY"))