Skip to main content
Glama
whw23

searxng-http-mcp

engine_info

Read-onlyIdempotent

Retrieve the list of enabled search engines grouped by category from a SearXNG instance. Use this to discover available engines before running a search with specific filters.

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 actual MCP tool handler function for engine_info. It is decorated with @mcp.tool(), uses a cache (5 min TTL), and calls fetch_engine_info() to get engines/categories from SearXNG config API.
    @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)
  • Helper that fetches engine/category info from the SearXNG /config API. Falls back to a hardcoded list of categories if the API call fails.
    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": {},
        }
  • The engine_info tool has no input parameters and returns a JSON string. Tool annotations mark it as read-only, non-destructive, and idempotent.
    @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 @mcp.tool() decorator registers engine_info as an MCP tool on the FastMCP instance (line 16: mcp = FastMCP(...)).
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=False,
        )
    )
  • Module-level cache variables for the engine_info tool. The cache TTL is 300 seconds (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?

Annotations already indicate readonly, nondestructive, idempotent. Description adds that response is cached for 5 minutes and confirms no web search is performed, enhancing transparency beyond annotations.

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, each adding distinct value: main purpose, return structure, usage advice, caching and exclusion of search. No wasted words, front-loaded with key info.

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?

For a simple tool with no parameters and an output schema, the description fully covers what the tool does, when to use it, caching behavior, and how it differs from search. Complete for the level of complexity.

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 in input schema, so description needs no param details. Schema coverage is 100% vacuously, baseline is 4. Description does not need to add parameter semantics.

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?

The description clearly states the tool retrieves available search engines and categories from SearXNG. It distinguishes itself from sibling tools autocomplete and search by focusing on discovery of engines.

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 advises using this before calling search with specific filters, and clarifies it does not perform web searches. Provides clear context for when to use this versus the search tool.

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