Skip to main content
Glama

internet_search

Search the web via Tavily API to retrieve relevant information, supporting queries with optional limits and raw content inclusion for enhanced contextual responses.

Instructions

Search the internet using Tavily API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_raw_contentNo
limitNo
queryYes

Implementation Reference

  • The core handler function for the internet_search tool, registered via @mcp.tool() decorator. It performs web search using the Tavily API, processes results including quick answer, content snippets, and follow-up questions.
    @mcp.tool() async def internet_search(query: str, limit: int = 3, include_raw_content: bool = False) -> str: """Search the internet using Tavily API.""" try: request_data = { "api_key": TAVILY_API_KEY, "query": query, "search_depth": "basic", "include_answer": True, "include_raw_content": include_raw_content, "include_images": False, "max_results": limit } data = await make_api_request(f"{TAVILY_API_BASE}/search", json=request_data) if not data: return "Failed to perform internet search. Please try again later." results = [] if data.get("answer"): results.append(f"Quick Answer: {data['answer']}") if data.get("results"): for idx, result in enumerate(data["results"][:limit], 1): result_str = f"{idx}. {result.get('title', 'No title')}\n URL: {result.get('url', 'No URL')}" if result.get("content"): result_str += f"\n Content: {result['content'][:500]}..." # Truncate content results.append(result_str) if data.get("follow_up_questions"): results.append("\nSuggested follow-up questions:") results.extend(f"- {q}" for q in data["follow_up_questions"]) return "\n\n".join(results) if results else "No results found." except Exception as e: logger.error(f"Error in internet_search: {e}") return "Failed to perform internet search due to an internal error."

Other Tools

Related 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/dev484p/AgenticAI_MCP'

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