Skip to main content
Glama

test_wikipedia_connectivity

Read-onlyIdempotent

Check whether the Wikipedia API is reachable and responsive. Returns the base URL, language, site info, and response time, or reports failure with error 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
statusYes
urlYes
languageYes
site_nameNo
serverNo
response_time_msNo
errorNo
error_typeNo

Implementation Reference

  • The handler function for the 'test_wikipedia_connectivity' tool. It calls wikipedia_client.test_connectivity() and rounds the response_time_ms if present.
    @register_tool("test_wikipedia_connectivity", model_output_schema(ConnectivityResponse))
    def test_wikipedia_connectivity():
        """
        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()
    
        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
  • The output schema/model for the connectivity test tool response.
    class ConnectivityResponse(MCPBaseModel):
        status: str
        url: str
        language: str
        site_name: Optional[str] = None
        server: Optional[str] = None
        response_time_ms: Optional[float] = None
        error: Optional[str] = None
        error_type: Optional[str] = None
  • The registration decorator that registers the tool under both the canonical name and the 'wikipedia_' alias.
    def register_tool(name: str, output_schema: dict[str, Any]):
        def decorator(func):
            server.tool(
                func,
                name=name,
                annotations=_READ_ONLY_TOOL_ANNOTATIONS,
                output_schema=output_schema,
            )
            server.tool(
                func,
                name=f"wikipedia_{name}",
                annotations=_READ_ONLY_TOOL_ANNOTATIONS,
                output_schema=output_schema,
            )
            return func
    
        return decorator
  • The helper method on WikipediaClient that actually performs the HTTP request to the Wikipedia API and returns connectivity diagnostics.
    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}")
            data, error = self._request_json(
                url=test_url,
                params=test_params,
                timeout=10,
                retries=1,
            )
            if error:
                return {
                    "status": "failed",
                    "url": test_url,
                    "language": self.base_language,
                    "error": error.get("message", "Connectivity test failed"),
                    "error_type": error.get("error_type", "RequestError"),
                }
    
            site_info = (data or {}).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"),
                "response_time_ms": None,
            }
    
        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?

Annotations already denote read-only, idempotent, non-destructive behavior. The description adds value by detailing the error reporting ('failed' with details), which is not captured in 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?

Two concise sentences with no wasted words. The purpose and outputs are front-loaded, making it efficient for agent parsing.

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 and presence of output schema, the description fully covers required context: it explains output fields and error conditions, ensuring completeness.

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 are present, so baseline is 4. The description effectively explains what the tool returns, adding semantic meaning beyond the empty schema.

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 it provides diagnostics for Wikipedia API connectivity, listing specific return values (base URL, language, site info, response time). This distinguishes it from sibling tools focused on content retrieval.

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?

While not explicitly stating when to use, the diagnostic purpose is clear, and the tool is distinct from content-focused siblings. The description implies use for checking connectivity before other calls.

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