Skip to main content
Glama
shiquda

mediawiki-mcp-server

search

Find wiki pages across MediaWiki sites like Wikipedia and Fandom by entering search terms, returning relevant results for research and information gathering.

Instructions

Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched. Args: query: The query to search for limit: The number of results to return Returns: A list of pages that match the query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Implementation Reference

  • The main handler function for the 'search' MCP tool. It takes a query and limit, constructs API parameters, calls the make_request helper to query the MediaWiki search API, and returns the response.
    @mcp.tool()
    async def search(query: str, limit: int = 5):
        """
        Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched.
        Args:
            query: The query to search for
            limit: The number of results to return
        Returns:
            A list of pages that match the query
        """
        path = "search/page"
        params = {
            "q": query,
            "limit": limit,
        }
        response = await make_request(path, params)
        return response
  • Input schema defined by type hints (query: str, limit: int=5) and docstring describing parameters and return value.
    async def search(query: str, limit: int = 5):
        """
        Search for a wiki page. The shorter the request, the better, preferably containing only the main term to be searched.
        Args:
            query: The query to search for
            limit: The number of results to return
        Returns:
            A list of pages that match the query
        """
  • The @mcp.tool() decorator registers the search function as an MCP tool with FastMCP instance.
    @mcp.tool()
  • Helper function to make HTTP requests to the MediaWiki API, handling proxies, redirects, and errors. Used by the search tool.
    async def make_request(path: str, params: dict) -> httpx.Response:
        headers = {
            "User-Agent": USER_AGENT,
        }
        url = config.base_url + config.path_prefix + path
        proxies = get_proxy_settings()
        async with httpx.AsyncClient(proxies=proxies, follow_redirects=True) as client:
            try:
                response = await client.get(url, headers=headers, params=params)
                if response.status_code in (301, 302, 303, 307, 308):
                    final_response = await client.get(
                        response.headers["Location"], headers=headers
                    )
                    return final_response.json()
                return response.json()
            except httpx.HTTPStatusError as e:
                logger.error(e)
                return {"error": e}
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the search returns a list of pages, which is helpful. However, it doesn't address important behavioral aspects like pagination, sorting, relevance ranking, error conditions, or performance characteristics. For a search tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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?

The description is appropriately concise with three clear sections: purpose statement, usage advice, parameter documentation, and return value. Each sentence serves a distinct purpose. The structure with labeled 'Args:' and 'Returns:' sections is helpful, though the formatting could be cleaner.

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

Completeness3/5

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

For a search tool with 2 parameters, no annotations, and no output schema, the description provides basic but incomplete coverage. It explains what the tool does and documents parameters, but lacks details about the search algorithm, result format beyond 'list of pages,' error handling, or performance considerations. The absence of output schema means the description should ideally explain the return structure more thoroughly.

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 description coverage is 0%, so the schema provides no parameter documentation. The description explicitly documents both parameters: 'query: The query to search for' and 'limit: The number of results to return.' This adds meaningful semantics beyond the bare schema. However, it doesn't provide format guidance for the query or explain the default limit value (5 from schema).

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?

The description clearly states the tool's purpose: 'Search for a wiki page.' It specifies the resource (wiki page) and action (search). However, it doesn't explicitly differentiate from the sibling tool 'get_page' - we can infer search returns multiple results while get_page likely retrieves a specific page, but this distinction isn't stated.

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

Usage Guidelines3/5

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

The description provides some usage guidance: 'The shorter the request, the better, preferably containing only the main term to be searched.' This offers practical advice but doesn't explicitly state when to use this tool versus the 'get_page' sibling. There's implied context that this is for finding pages rather than retrieving specific ones, but no explicit alternative guidance.

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/shiquda/mediawiki-mcp-server'

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