get_wca_countries
Retrieve a complete list of countries recognized by the World Cube Association with their names and ISO2 codes for regional filtering in speedcubing data queries.
Instructions
Get all WCA countries.
Returns a list of all countries recognized by the World Cube Association including country names and ISO2 codes used for regional filtering.
Returns: List of WCA countries with names and ISO2 codes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/wca_mcp_server/main.py:48-66 (handler)The handler function for the 'get_wca_countries' tool, decorated with @mcp.tool() which registers it with the MCP server. It fetches the list of WCA countries by calling WCAAPIClient.get_countries() and handles errors.@mcp.tool() async def get_wca_countries() -> List[Dict[str, Any]]: """Get all WCA countries. Returns a list of all countries recognized by the World Cube Association including country names and ISO2 codes used for regional filtering. Returns: List of WCA countries with names and ISO2 codes """ try: async with WCAAPIClient() as client: countries = await client.get_countries() return countries except APIError as e: raise Exception(f"Failed to fetch WCA countries: {e}") except Exception as e: raise Exception(f"Unexpected error fetching WCA countries: {e}")
- src/wca_mcp_server/client.py:315-326 (helper)Supporting method in WCAAPIClient class that makes the HTTP request to the WCA API endpoint 'countries.json' and extracts the countries list from the response.async def get_countries(self) -> List[Dict[str, Any]]: """Get all countries. Returns: List of country data """ data = await self._make_request("countries.json") # The API returns paginated data with items array if isinstance(data, dict) and "items" in data: return data["items"] return data.get("countries", [])