web_search
Search the web to gather country information for creating detailed profiles with embedded images and credits.
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, registered via @mcp.tool(). It takes a query string, uses the global TavilyClient to perform a web search, and returns the search results. The function signature and docstring define the input schema.@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)Global TavilyClient instance initialized with API key from environment, used by the web_search tool for performing searches.client = TavilyClient(os.getenv("TAVILY_API_KEY"))
- server.py:14-14 (registration)Registration of the web_search tool using the FastMCP decorator.@mcp.tool()