Skip to main content
Glama
whw23

searxng-http-mcp

engine_info

Read-onlyIdempotent

Retrieve enabled search engines and categories from your SearXNG instance to plan targeted searches before executing any query.

Instructions

Get available search engines and categories from the SearXNG instance.

Returns the list of enabled engines grouped by category. Use this to discover what engines and categories are available before calling search with specific engines or categories filters.

Response is cached for 5 minutes. Does not perform any web search — use the search tool for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The engine_info MCP tool handler function. It fetches engine info via fetch_engine_info() with a 5-minute cache (using _engine_info_cache and _engine_info_cache_ts globals). Returns JSON string with categories, engines, and category_engines.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=False,
        )
    )
    async def engine_info() -> str:
        """Get available search engines and categories from the SearXNG instance.
    
        Returns the list of enabled engines grouped by category.
        Use this to discover what engines and categories are available
        before calling search with specific engines or categories filters.
    
        Response is cached for 5 minutes. Does not perform any web search — use the search tool for that.
        """
        global _engine_info_cache, _engine_info_cache_ts
        now = time.monotonic()
        if _engine_info_cache is not None and now - _engine_info_cache_ts < ENGINE_INFO_CACHE_TTL:
            return json.dumps(_engine_info_cache, ensure_ascii=False)
    
        info = await fetch_engine_info()
        _engine_info_cache = info
        _engine_info_cache_ts = now
        return json.dumps(info, ensure_ascii=False)
  • The tool annotation/decorator configuration for engine_info. Uses @mcp.tool with readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=False,
        )
    )
  • The tool is registered via the @mcp.tool() decorator on the engine_info async function (line 334). The mcp instance is FastMCP defined on line 16-22.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=False,
        )
    )
  • fetch_engine_info() helper function that fetches available engines and categories from the SearXNG /config API. Handles both list and dict category formats, filters enabled engines, and returns a dict with categories, engines, and category_engines. Has a fallback with hardcoded categories on error.
    async def fetch_engine_info() -> dict:
        """Fetch available engines and categories from SearXNG config API."""
        try:
            client = await _get_client()
            resp = await client.get(
                f"{SEARXNG_BASE_URL}/config", timeout=10.0
            )
            if resp.status_code == 200:
                data = resp.json()
                raw_categories = data.get("categories", [])
                if isinstance(raw_categories, list):
                    categories = raw_categories
                elif isinstance(raw_categories, dict):
                    categories = list(raw_categories.keys())
                else:
                    categories = []
    
                engines = []
                category_engines: dict[str, list[str]] = {}
                for e in data.get("engines", []):
                    if not e.get("enabled", True):
                        continue
                    name = e["name"]
                    engines.append(name)
                    for cat in e.get("categories", []):
                        category_engines.setdefault(cat, []).append(name)
    
                return {
                    "categories": categories,
                    "engines": engines,
                    "category_engines": category_engines,
                }
        except Exception:
            pass
        # Fallback from SearXNG 2024.12 — update if upstream categories change
        return {
            "categories": [
                "general", "images", "videos", "news", "map",
                "music", "it", "science", "files", "social media",
                "web", "apps", "books", "packages", "repos",
                "software wikis", "scientific publications", "q&a",
                "shopping", "movies", "translate", "radio", "lyrics",
                "currency", "weather", "other", "dictionaries",
                "define", "icons", "cargo", "wikimedia",
            ],
            "engines": [],
            "category_engines": {},
        }
  • Global cache variables for engine_info: _engine_info_cache (dict), _engine_info_cache_ts (float), and ENGINE_INFO_CACHE_TTL=300 (5 minutes).
    _engine_info_cache: dict | None = None
    _engine_info_cache_ts: float = 0
    ENGINE_INFO_CACHE_TTL = 300
Behavior5/5

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

Discloses caching behavior (5-minute cache) beyond annotations. Annotations already declare readOnlyHint etc., and description adds no contradiction. Clearly states it's a discovery-only tool.

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?

Four sentences, front-loaded with purpose. Every sentence adds value: purpose, return format, usage hint, caching, and disambiguation from search. No wasted words.

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

Completeness5/5

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

Given zero parameters, good annotations, and presence of output schema, description fully covers tool behavior. Explains response grouping, caching, and non-search nature. No gaps.

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

Parameters4/5

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

No parameters exist, so baseline is 4. Description adds value by explaining what is returned (list grouped by category) and caching, but no param info needed.

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

Purpose5/5

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

Clear verb 'Get' and resource 'search engines and categories'. Explicitly distinguishes from search tool by stating it does not perform web search, and from autocomplete implicitly.

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

Usage Guidelines5/5

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

Explicitly states when to use: before calling search with filters. Clearly says what it does not do (no web search) and points to the search tool, providing both usage context and alternatives.

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/whw23/searxng_http_mcp'

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