Skip to main content
Glama
whw23

searxng-http-mcp

autocomplete

Read-onlyIdempotent

Enter partial keywords to receive query suggestions from SearXNG. Use these to discover relevant search terms before a full search.

Instructions

Get search query suggestions from SearXNG.

Returns a list of autocomplete suggestions for the given partial query. Use this to discover relevant search terms before performing a full search.

Best results come from 1-2 meaningful keywords (e.g., "python async"). Single characters return overly broad suggestions; full sentences return none.

Makes an external API call to the configured autocomplete backend (e.g., Bing, Google). Not suitable for full web search (use search tool) or engine discovery (use engine_info tool).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesPartial query string to get suggestions for. Best results with 1-2 keywords (e.g., 'python async'). Single characters are too broad; full sentences return nothing.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of the autocomplete tool handler. It uses @mcp.tool() decorator, takes a 'query' parameter with Pydantic Field description, makes an HTTP GET request to SearXNG's /autocompleter endpoint, and returns the JSON response. Returns an error dict on non-200 status.
    async def autocomplete(
        query: Annotated[str, Field(
            description="Partial query string to get suggestions for. Best results with 1-2 keywords (e.g., 'python async'). Single characters are too broad; full sentences return nothing.",
        )],
    ) -> str:
        """Get search query suggestions from SearXNG.
    
        Returns a list of autocomplete suggestions for the given partial query.
        Use this to discover relevant search terms before performing a full search.
    
        Best results come from 1-2 meaningful keywords (e.g., "python async").
        Single characters return overly broad suggestions; full sentences return none.
    
        Makes an external API call to the configured autocomplete backend (e.g., Bing, Google).
        Not suitable for full web search (use search tool) or engine discovery (use engine_info tool).
        """
        client = await _get_client()
        resp = await client.get(
            f"{SEARXNG_BASE_URL}/autocompleter",
            params={"q": query},
            timeout=10.0,
        )
        if resp.status_code != 200:
            return json.dumps({"error": f"Autocomplete failed with status {resp.status_code}"})
        return json.dumps(resp.json(), ensure_ascii=False)
  • The @mcp.tool() decorator that registers the autocomplete function as an MCP tool with annotations (readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=True).
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=True,
        )
    )
  • Input parameter definition for autocomplete: 'query' is an Annotated[str, Field(...)] describing that it expects a partial query string with best results from 1-2 keywords.
        query: Annotated[str, Field(
            description="Partial query string to get suggestions for. Best results with 1-2 keywords (e.g., 'python async'). Single characters are too broad; full sentences return nothing.",
        )],
    ) -> str:
  • Test fixture mocking the autocomplete response as a list of strings (['python tutorial', 'python download', 'python documentation']).
    @pytest.fixture
    def mock_search_response():
        return {
            "results": [
                {
                    "title": "Example Result",
                    "url": "https://example.com",
                    "content": "This is a test result.",
                    "engines": ["google", "bing"],
                    "score": 5.0,
                    "category": "general",
                    "parsed_url": ["https", "example.com"],
                    "positions": [1],
                    "template": "default.html",
                }
            ],
            "answers": ["42"],
            "corrections": [],
            "suggestions": ["example query"],
            "infoboxes": [],
            "unresponsive_engines": [],
            "number_of_results": 1,
        }
    
    
    @pytest.fixture
    def mock_autocomplete_response():
Behavior4/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds that it makes an external API call to a configurable backend, which goes beyond annotations. No contradictions.

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?

8 sentences, well-structured, front-loaded with purpose, then usage guidance, then alternatives. Every sentence adds value, no repetition.

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 single-parameter tool with output schema, description covers input constraints, external dependency, usage context, and boundaries with sibling tools. Fully adequate.

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?

Schema coverage is 100% with parameter description already quoting best practices. Description adds no new parameter info beyond what schema provides, so baseline 3 applies.

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?

Clearly states it gets search query suggestions from SearXNG. Distinguishes from siblings 'search' and 'engine_info' by explicitly stating what it is not suitable for.

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 says to use for discovering relevant search terms before a full search, gives best practice (1-2 keywords), warns against single characters and full sentences, and tells when not to use.

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