Skip to main content
Glama

search

Perform web searches with customizable parameters including categories, search engines, language, time range, and safe search settings.

Instructions

Search using SearXNG

Args:
    query: The search query
    categories: Optional comma-separated list of categories
    engines: Optional comma-separated list of engines
    language: Optional language code
    page: Page number (default: 1)
    time_range: Optional time range (day, month, year)
    safe_search: Safe search level (0, 1, 2)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
categoriesNo
enginesNo
languageNo
pageNo
time_rangeNo
safe_searchNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:37-87 (handler)
    The search tool handler, decorated with @mcp.tool(). It performs an HTTP request to a SearXNG instance using parameters provided to the tool.
    @mcp.tool()
    def search(query: str, categories: Optional[str] = None, engines: Optional[str] = None, 
               language: Optional[str] = None, page: int = 1, time_range: Optional[str] = None,
               safe_search: int = 1) -> Dict[str, Any]:
        """
        Search using SearXNG
        
        Args:
            query: The search query
            categories: Optional comma-separated list of categories
            engines: Optional comma-separated list of engines
            language: Optional language code
            page: Page number (default: 1)
            time_range: Optional time range (day, month, year)
            safe_search: Safe search level (0, 1, 2)
        """
        logger.info(f"Received search request - Query: {query}")
        
        params = {
            "q": query,
            "format": "json",
            "pageno": page,
            "safesearch": safe_search
        }
        
        if categories:
            params["categories"] = categories
            logger.debug(f"Categories specified: {categories}")
        if engines:
            params["engines"] = engines
            logger.debug(f"Engines specified: {engines}")
        if language:
            params["language"] = language
            logger.debug(f"Language specified: {language}")
        if time_range:
            params["time_range"] = time_range
            logger.debug(f"Time range specified: {time_range}")
            
        logger.debug(f"Making request to SearXNG with params: {params}")
        try:
            response = client.get(urljoin(SEARXNG_URL, "/search"), params=params)
            response.raise_for_status()
            result = response.json()
            logger.info(f"Search completed successfully - Found {len(result.get('results', []))} results")
            return result
        except httpx.HTTPError as e:
            logger.error(f"HTTP error occurred during search: {str(e)}")
            raise
        except Exception as e:
            logger.error(f"Unexpected error during search: {str(e)}")
            raise
Behavior2/5

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

No annotations provided, so description carries full burden. Fails to disclose what SearXNG aggregation entails, return value structure (despite output schema existing, behavioral traits like rate limits or latency are absent), or mutation effects.

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?

Well-structured with purpose front-loaded in the first line followed by clear Args section. No redundant prose. The Args list is necessary given zero schema coverage, so it earns its place effectively.

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

Completeness2/5

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

Despite 7 parameters and 0% schema coverage, description lacks crucial domain context. Misses the critical relationship to `get_available_engines` for valid engine names, doesn't explain SearXNG's meta-search nature, and omits behavioral constraints. Output schema presence excuses return value documentation, but operational context is insufficient.

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?

With 0% schema description coverage, the Args section compensates by documenting all 7 parameters. Adds valuable structural hints ('comma-separated', specific enum values for time_range/day|month|year and safe_search/0,1,2) not present in raw schema. However, lacks semantic detail on valid category strings or that engines must come from sibling tool.

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?

States specific verb (Search) and resource (SearXNG), clearly identifying this as a web search operation. Distinguishes implicitly from sibling `get_available_engines` (this performs search vs listing engines), though explicit differentiation would strengthen it further.

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?

Provides no guidance on when to use versus alternatives, prerequisites, or when not to use. Critically misses the relationship to `get_available_engines` for populating the `engines` parameter, leaving agents to guess valid values.

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/maccam912/searxng-mcp-server'

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