get_competition_by_id
Retrieve detailed WCA competition information including venue details, events, results, and organizer data using a specific competition ID.
Instructions
Get detailed information about a specific competition by its ID.
Returns comprehensive information about a WCA competition including venue details, events, results, and organizer information.
Args: competition_id: WCA competition ID (e.g., "WC2023")
Returns: Detailed competition information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| competition_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"competition_id": {
"title": "Competition Id",
"type": "string"
}
},
"required": [
"competition_id"
],
"type": "object"
}
Implementation Reference
- src/wca_mcp_server/main.py:303-323 (handler)The MCP tool handler for 'get_competition_by_id', including @mcp.tool() registration decorator. Fetches competition details via WCAAPIClient.get_competition.@mcp.tool() async def get_competition_by_id(competition_id: str) -> Dict[str, Any]: """Get detailed information about a specific competition by its ID. Returns comprehensive information about a WCA competition including venue details, events, results, and organizer information. Args: competition_id: WCA competition ID (e.g., "WC2023") Returns: Detailed competition information """ try: async with WCAAPIClient() as client: competition_data = await client.get_competition(competition_id) return competition_data except APIError as e: raise Exception(f"Failed to get competition {competition_id}: {e}") except Exception as e: raise Exception(f"Unexpected error getting competition {competition_id}: {e}")
- src/wca_mcp_server/client.py:125-134 (helper)WCAAPIClient helper method that performs the actual API request to retrieve competition data by ID from the WCA static API.async def get_competition(self, competition_id: str) -> Dict[str, Any]: """Get a specific competition by ID. Args: competition_id: Competition ID Returns: Competition data """ return await self._make_request(f"competitions/{competition_id}.json")
- Pydantic model defining the structure and validation for competition data returned by the tool.class Competition(BaseModel): """WCA competition information.""" id: str = Field(..., description="Competition identifier") name: str = Field(..., description="Competition name") city: str = Field(..., description="Competition city") country: str = Field(..., description="Competition country code") date: CompetitionDate = Field(..., description="Competition date information") is_canceled: bool = Field(..., alias="isCanceled", description="Whether competition is canceled") events: List[str] = Field(..., description="List of event IDs in the competition") wca_delegates: List[ContactInfo] = Field(..., alias="wcaDelegates", description="WCA delegates") organisers: List[ContactInfo] = Field(..., description="Competition organizers") venue: Venue = Field(..., description="Venue information") information: Optional[str] = Field(None, description="Additional competition information") external_website: Optional[str] = Field(None, alias="externalWebsite", description="External website URL")