Skip to main content
Glama

Tavily Web Search MCP Server

by bakshidwarak

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

NameRequiredDescriptionDefault
queryYes

Input Schema (JSON Schema)

{ "properties": { "query": { "title": "Query", "type": "string" } }, "required": [ "query" ], "type": "object" }

Implementation Reference

  • server.py:12-16 (handler)
    The web_search tool handler function. It is registered via the @mcp.tool() decorator, defines input (query: str) and output (str) schema via type hints and docstring, and implements the logic by calling TavilyClient.get_search_context with the query and returning the search results.
    @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 (registration)
    Registration of the web_search tool using the FastMCP @mcp.tool() decorator.
    @mcp.tool()
  • Schema definition via function signature (input: query str, output: str) and docstring describing the tool.
    def web_search(query: str) -> str: """Search the web for information about the given query"""
  • Initialization of the TavilyClient instance used by the web_search handler.
    client = TavilyClient(os.getenv("TAVILY_API_KEY"))
  • server.py:3-3 (helper)
    Import of TavilyClient library required for web_search implementation.
    from tavily import TavilyClient

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bakshidwarak/AIE8-MCP-Session'

If you have feedback or need assistance with the MCP directory API, please join our Discord server