Coverage for src/ecnl/adapters/inbound/tools/standings.py: 100%
12 statements
« prev ^ index » next coverage.py v7.14.2, created at 2026-06-28 08:19 +0000
« prev ^ index » next coverage.py v7.14.2, created at 2026-06-28 08:19 +0000
1"""Standings tool."""
3import logging
5from mcp.server.fastmcp import FastMCP
7from ....application.service import ECNLService
8from ....ports.inbound import Authorizer
9from ..formatters import _fmt_standings
10from ._base import _READ_ANNOTATIONS, _safe_call_authorized
12logger = logging.getLogger(__name__)
15def register_standings_tools(mcp: FastMCP, service: ECNLService, authorizer: Authorizer) -> None:
16 """Register the standings tool on ``mcp``."""
18 @mcp.tool(annotations=_READ_ANNOTATIONS)
19 async def get_standings(event_id: int, division_id: int, flight_id: int) -> str:
20 """Get the standings table for a flight.
22 Returns each team's W-L-D record, points, and points-per-game ordered as
23 the league publishes them. Get the division and flight IDs from
24 get_event_overview.
26 Args:
27 event_id: Numeric event ID (e.g. 3933).
28 division_id: Age-group division ID from get_event_overview.
29 flight_id: Flight ID from get_event_overview.
30 """
31 logger.info("tool=get_standings event_id=%r division_id=%r flight_id=%r", event_id, division_id, flight_id)
32 return await _safe_call_authorized(
33 authorizer, "get_standings", service.get_standings(event_id, division_id, flight_id), _fmt_standings
34 )