Skip to main content
Glama
alexsmirnov

MCP Server for continue.dev

by alexsmirnov

web_search

Search the web for information to enhance LLM interactions within the continue.dev environment by providing relevant data and resources.

Instructions

Search the web for information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • Registers the web_search tool with the MCP server using the @tool decorator.
    @self.mcp.tool(name="web_search", description="Search the web for information")
  • The handler function for the web_search tool. It performs some root listing logging and delegates the search to perplexity_search.do_search.
    async def web_search(query: str) -> str:
        """
        Performs a web search using the provided query. Find the most relevant pages
        and return summary result.
        Args:
            query: The search query.
        Returns:
            The summary of the most relevant search results.
        """
        try:
            session: ServerSession = self.mcp.get_context().session
            if session.check_client_capability(ClientCapabilities(roots=RootsCapability())) :
                result = await session.list_roots()
                logger.info(f"Result: {result}")
                for root in result.roots:
                    logger.info(f"Root: {root.name} , location: {root.uri}")
            else:
                logger.info("Client does not support roots capability")
                # Try to get the roots from the environment variable ROOT
                root_value = os.getenv("ROOT")
                logger.info(f"ROOT environment variable: {root_value}")
        except Exception as e:
            logger.error(f"Error listing roots: {e}")
        return await perplexity_search.do_search(query, self.config)
  • Core helper function that performs the actual web search using Perplexity AI API.
    async def do_search(query: str, config: ServerConfig) -> str:
        """
        Performs a search and returns the results. 
        Args:
            query: The search query.
    
        Returns:
            The search query string back.
        """
        
        url = "https://api.perplexity.ai/chat/completions"
        headers = {
            "Authorization": f"Bearer {config.perplexity_api_key}",
            "Content-Type": "application/json"
        }
        payload = {
            "model": "sonar",
            "messages": [
                {"role": "system", "content": "Be precise and concise."},
                {"role": "user", "content": query}
            ],
            "max_tokens": 1000,
            "temperature": 0.01,
            "top_p": 0.9,
            "return_related_questions": False,
            "web_search_options": {
               "search_context_size": "medium"
          }
        }
    
        async with httpx.AsyncClient() as client:
            response = await client.post(url, json=payload, headers=headers)
            response.raise_for_status()
            return format_response_with_citations(response.json())
  • Helper function to format the Perplexity API response with citations in markdown.
    def format_response_with_citations(response: dict) -> str:
        """
        Formats the response from Perplexity.ai to include citations as a markdown list.
    
        Args:
            response: The JSON response from Perplexity.ai.
    
        Returns:
            A formatted string with the content and citations.
        """
        content = response.get("choices", [{}])[0].get("message", {}).get("content", "No content available")
        citations = response.get("citations", [])
    
        if citations:
            citations_md = "\n".join([f"- {url}" for url in citations])
            return f"{content}\n\n### Citations\n{citations_md}"
        return content
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description 'Search the web for information' does not disclose any behavioral traits such as rate limits, authentication needs, response format, pagination, or whether it's a read-only or mutating operation. It fails to provide essential context for safe and effective use.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It is appropriately sized for a simple tool and front-loaded with the core action, making it easy to parse quickly. Every part of the sentence contributes to the basic understanding.

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

Completeness1/5

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

Given the tool's complexity (a web search tool with no annotations, no output schema, and low parameter documentation), the description is incomplete. It lacks details on behavior, output, error handling, and usage context, making it insufficient for an AI agent to select and invoke the tool correctly without additional assumptions or trial-and-error.

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

Parameters1/5

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

The input schema has 1 parameter with 0% description coverage, and the description does not add any meaning beyond what the schema provides. It mentions 'Search the web' but does not explain the 'query' parameter's semantics, format, or constraints (e.g., length limits, special syntax). With low schema coverage, the description fails to compensate, leaving the parameter poorly documented.

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

Purpose3/5

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

The description 'Search the web for information' states the general purpose with a verb ('Search') and resource ('the web'), but it's vague about scope and functionality. It doesn't specify what kind of search this is (e.g., general web search, news search, image search) or how results are returned, which leaves the purpose ambiguous despite being understandable at a basic level.

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. There are no sibling tools mentioned, so no explicit comparison is needed, but it lacks any context about appropriate use cases, prerequisites, or limitations (e.g., when to prefer this over other search methods). This leaves the agent with minimal direction.

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/alexsmirnov/obsidian-second-brain-mcp'

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