Skip to main content
Glama

ShallowCodeResearch_agent_web_search

Perform web searches to retrieve results with summaries and URLs for research purposes within the MCP Hub research assistant workflow.

Instructions

Wrapper for WebSearchAgent to perform web searches. Returns: Web search results with summaries and URLs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoThe search query to execute

Implementation Reference

  • app.py:738-748 (handler)
    Handler function exposed as MCP tool that delegates to WebSearchAgent.search for performing web searches via Tavily API.
    def agent_web_search(query: str) -> dict:
        """
        Wrapper for WebSearchAgent to perform web searches.
    
        Args:
            query (str): The search query to execute
    
        Returns:
            dict: Web search results with summaries and URLs
        """
        return web_search.search(query)
  • app.py:979-987 (registration)
    Gradio Interface that registers the agent_web_search handler as an MCP tool with api_name 'agent_web_search_service', likely prefixed to 'ShallowCodeResearch_agent_web_search' in the HF space.
    with gr.Tab("Agent: Web Search", scale=1):
        gr.Interface(
            fn=agent_web_search,
            inputs=[gr.Textbox(label="Search Query", placeholder="Enter search term…", lines=12)],
            outputs=gr.JSON(label="Web Search Results (Tavily)", height=305),
            title="Web Search Agent",
            description="Perform a Tavily web search with configurable result limits.",
            api_name="agent_web_search_service",
        )
  • The core WebSearchAgent.search method implementing the Tavily web search logic with decorators for performance tracking, retry, rate limiting, circuit breaking, and caching.
    @track_performance(operation_name="web_search")
    @retry_sync(**RetryConfig.SEARCH_API)
    @rate_limited("tavily")
    @circuit_protected("tavily")
    @cached(ttl=600)  # Cache for 10 minutes
    def search(self, query: str) -> Dict[str, Any]:
        """
        Perform a web search using the Tavily API to gather internet information.
    
        Executes a synchronous web search with the specified query and returns
        structured results including search summaries, URLs, and content snippets.
        Results are cached for performance optimization.
    
        Args:
            query (str): The search query string to look up on the web
    
        Returns:
            Dict[str, Any]: A dictionary containing search results, summaries, and metadata
                           or error information if the search fails
        """
        try:
            validate_non_empty_string(query, "Search query")
            logger.info(f"Performing web search: {query}")
    
            response = self.client.search(
                query=query,
                search_depth="basic",
                max_results=app_config.max_search_results,
                include_answer=True
            )
    
            logger.info(f"Search completed, found {len(response.get('results', []))} results")
            return {
                "query": response.get("query", query),
                "tavily_answer": response.get("answer"),
                "results": response.get("results", []),
                "data_source": "Tavily Search API",
            }
    
        except ValidationError as e:
            logger.error(f"Web search validation failed: {str(e)}")
            return {"error": str(e), "query": query, "results": []}
        except Exception as e:
            logger.error(f"Web search failed: {str(e)}")
            return {"error": f"Tavily API Error: {str(e)}", "query": query, "results": []}
  • Instantiation of the WebSearchAgent instance used by the handler.
    question_enhancer = QuestionEnhancerAgent()
    web_search = WebSearchAgent()
    llm_processor = LLMProcessorAgent()
    citation_formatter = CitationFormatterAgent()
    code_generator = CodeGeneratorAgent()
    code_runner = CodeRunnerAgent()
  • app.py:1234-1240 (registration)
    Gradio app launch with mcp_server=True, enabling MCP protocol exposure of all registered tools including the web search agent.
    hub.launch(
        mcp_server=True,
        server_name="0.0.0.0",
        server_port=7860,
        show_error=True,
        share=True
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool returns 'web search results with summaries and URLs', which gives some output context, but lacks details on rate limits, authentication needs, error handling, or whether it's read-only or mutative. For a web search tool, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, consisting of two clear sentences that state the tool's function and return value. There's no unnecessary information, making it efficient, though it could be slightly more structured by explicitly separating purpose from output details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (web search with one parameter) and lack of annotations and output schema, the description is minimally adequate. It covers the basic purpose and return format but misses behavioral details like pagination, result limits, or error cases. Without an output schema, more detail on return values would be helpful, but it's not entirely incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'query' parameter fully documented. The description doesn't add any additional meaning beyond what the schema provides, such as query formatting tips or examples. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: it's a wrapper for WebSearchAgent that performs web searches and returns results with summaries and URLs. It specifies the verb ('perform web searches') and resource ('web search results'), though it doesn't explicitly differentiate from siblings like 'ShallowCodeResearch_agent_question_enhancer' or 'ShallowCodeResearch_agent_research_request' which might also involve search-related functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any specific contexts, prerequisites, or exclusions, nor does it reference sibling tools that might handle similar tasks, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/CodeHalwell/gradio-mcp-agent-hack'

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