web_search
Search the web to find information and answer questions using real-time internet data for research and fact-checking purposes.
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-17 (handler)The main handler function for the web_search tool. It takes a query string, uses the global TavilyClient to search, and returns the search results.def web_search(query: str) -> str: """Search the web for information about the given query""" search_results = client.get_search_context(query=query) return search_results
- server.py:13-13 (registration)The @mcp.tool() decorator registers the web_search function as an MCP tool.@mcp.tool()
- server.py:11-11 (helper)Global client instance for Tavily search API, used by the web_search handler.client = TavilyClient(os.getenv("TAVILY_API_KEY"))