Skip to main content
Glama

test_wikipedia_connectivity

Diagnose Wikipedia API connectivity by testing connection status, response time, and retrieving base URL with language details.

Instructions

Provide diagnostics for Wikipedia API connectivity.

Returns the base API URL, language, site information, and response time in milliseconds. If connectivity fails, status will be 'failed' with error details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'test_wikipedia_connectivity', registered via @server.tool() decorator. It calls the underlying WikipediaClient.test_connectivity() method and formats the response time.
    @server.tool()
    def test_wikipedia_connectivity() -> Dict[str, Any]:
        """
        Provide diagnostics for Wikipedia API connectivity.
    
        Returns the base API URL, language, site information, and response
        time in milliseconds. If connectivity fails, status will be 'failed'
        with error details.
        """
        logger.info("Tool: Testing Wikipedia connectivity")
        diagnostics = wikipedia_client.test_connectivity()
    
        # Round response_time_ms for nicer output if present
        if (
            diagnostics.get("status") == "success"
            and "response_time_ms" in diagnostics
            and isinstance(diagnostics["response_time_ms"], (int, float))
        ):
            diagnostics["response_time_ms"] = round(float(diagnostics["response_time_ms"]), 3)
        return diagnostics
  • Supporting method in WikipediaClient class that performs the actual connectivity test by querying the Wikipedia API siteinfo endpoint, measures response time, and handles exceptions.
    def test_connectivity(self) -> Dict[str, Any]:
        """
        Test connectivity to the Wikipedia API and return diagnostics.
    
        Returns:
            A dictionary with status, URL, language, site information, and response time.
            On failure, returns status 'failed' with error details.
        """
        test_url = f"https://{self.base_language}.wikipedia.org/w/api.php"
        test_params = {
            "action": "query",
            "format": "json",
            "meta": "siteinfo",
            "siprop": "general",
        }
    
        try:
            logger.info(f"Testing connectivity to {test_url}")
            response = requests.get(
                test_url,
                headers=self._get_request_headers(),
                params=test_params,
                timeout=10,
            )
            response.raise_for_status()
            data = response.json()
    
            site_info = data.get("query", {}).get("general", {})
    
            return {
                "status": "success",
                "url": test_url,
                "language": self.base_language,
                "site_name": site_info.get("sitename", "Unknown"),
                "server": site_info.get("server", "Unknown"),
                # Round response time to milliseconds with high precision
                "response_time_ms": response.elapsed.total_seconds() * 1000,
            }
    
        except Exception as exc:  # pragma: no cover - safeguarded
            logger.error("Connectivity test failed: %s", exc)
            return {
                "status": "failed",
                "url": test_url,
                "language": self.base_language,
                "error": str(exc),
                "error_type": type(exc).__name__,
            }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: what information it returns (base API URL, language, site info, response time), success/failure states, and error details. It doesn't mention rate limits or authentication needs, but those are likely not applicable for a connectivity test.

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?

The description is perfectly structured in two sentences: the first states the purpose, the second details the return values and error handling. Every word earns its place with zero waste or redundancy.

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 the tool's simplicity (0 parameters, no annotations, but has output schema), the description is complete. It explains what the tool does, what it returns, and how it handles failures. With an output schema present, it doesn't need to detail return value structures.

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?

The tool has 0 parameters with 100% schema description coverage, so the baseline would be 4. The description appropriately acknowledges this by not discussing parameters at all, focusing instead on what the tool does without inputs.

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 specific verb ('Provide diagnostics') and resource ('Wikipedia API connectivity'), distinguishing it from all sibling tools which focus on content retrieval rather than system diagnostics. It explicitly defines what the tool does in a way that differentiates it from alternatives.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool - for connectivity diagnostics rather than content retrieval. However, it doesn't explicitly state when NOT to use it or name specific alternative tools for different purposes, though the sibling tool list makes the distinction obvious.

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/Rudra-ravi/wikipedia-mcp'

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