get_club_profile
Retrieve detailed information about a Chess.com club, including member count and club details, using the club's URL identifier.
Instructions
Get information about a club on Chess.com
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/chess_mcp/server.py:210-221 (handler)The actual tool handler for get_club_profile. It is an async function decorated with @mcp.tool, taking a url_id parameter and calling make_api_request(f'club/{url_id}') to fetch club profile data from the Chess.com API.
async def get_club_profile(url_id: str) -> Dict[str, Any]: """ Get information about a club on Chess.com. Args: url_id: The URL identifier of the club Returns: Club profile data """ logger.info("Fetching club profile", url_id=url_id) return await make_api_request(f"club/{url_id}") - src/chess_mcp/server.py:209-209 (registration)The tool is registered via the @mcp.tool decorator on the get_club_profile function, with description 'Get information about a club on Chess.com'.
@mcp.tool(description="Get information about a club on Chess.com") - src/chess_mcp/server.py:26-80 (helper)The make_api_request helper function that get_club_profile relies on. It constructs the URL using the base Chess.com API URL and endpoint, makes an async HTTP GET request via httpx, and returns the JSON response as a dict.
async def make_api_request( endpoint: str, params: Optional[Dict[str, Any]] = None, accept_json: bool = True ) -> Union[Dict[str, Any], str]: """ Make a request to the Chess.com API. Args: endpoint: The API endpoint to request params: Optional query parameters accept_json: Whether to accept JSON response (True) or PGN (False) Returns: JSON response as dict or text response as string Raises: httpx.HTTPError: If the request fails """ url = f"{config.base_url}/{endpoint}" headers = { "accept": "application/json" if accept_json else "application/x-chess-pgn" } logger.debug( "Making API request", endpoint=endpoint, url=url, accept_json=accept_json, has_params=params is not None ) async with httpx.AsyncClient() as client: try: response = await client.get(url, headers=headers, params=params or {}) response.raise_for_status() if accept_json: result = response.json() logger.debug("API request successful", endpoint=endpoint, response_type="json") return result else: result = response.text logger.debug("API request successful", endpoint=endpoint, response_type="text") return result except httpx.HTTPError as e: logger.error( "API request failed", endpoint=endpoint, url=url, error=str(e), error_type=type(e).__name__ ) raise - src/chess_mcp/server.py:210-210 (schema)The input schema is defined by the function signature parameter 'url_id: str' - the URL identifier of the club. The return type is Dict[str, Any].
async def get_club_profile(url_id: str) -> Dict[str, Any]: