get_mlb_game_highlights
Retrieve MLB game highlights by providing a game ID to access key moments and plays from specific baseball games.
Instructions
Get game highlights for a specific game by game_id.
Args: game_id (int): The game ID.
Returns: dict: Game highlights.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| game_id | Yes |
Implementation Reference
- mlb_api.py:450-466 (handler)The handler function decorated with @mcp.tool(), which implements the tool logic by fetching highlights from the MLB API using mlb.get_game(game_id).content.highlights.@mcp.tool() def get_mlb_game_highlights(game_id: int) -> dict: """ Get game highlights for a specific game by game_id. Args: game_id (int): The game ID. Returns: dict: Game highlights. """ try: highlights = mlb.get_game(game_id).content.highlights return highlights except Exception as e: return {"error": str(e)}
- main.py:22-22 (registration)The call to setup_mlb_tools(mcp) in the main server file, which defines and registers all MLB tools including get_mlb_game_highlights via decorators.setup_mlb_tools(mcp)
- mlb_api.py:221-225 (registration)The setup_mlb_tools function where all MLB tools, including get_mlb_game_highlights, are defined and registered using @mcp.tool() decorators.def setup_mlb_tools(mcp): """Setup MLB tools for the MCP server""" @mcp.tool() def get_mlb_standings(