web_search
Search the web to find information and answers for any query, retrieving relevant results 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:16-20 (handler)The web_search tool handler function. It is registered via the @mcp.tool() decorator, defines the input schema via type hints (query: str), and implements the logic using a TavilyClient instance to perform the web search.@mcp.tool() 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:12-12 (helper)Initialization of the global TavilyClient instance used by the web_search tool.client = TavilyClient(os.getenv("TAVILY_API_KEY"))
- server.py:3-3 (helper)Import of TavilyClient library required for the web_search tool implementation.from tavily import TavilyClient