get_mlb_linescore
Retrieve detailed linescore data for a specific MLB game using its unique game ID. Access inning-by-inning scores, team performance, and game status through the MLB statistics API.
Instructions
Get linescore for a specific game by game_id.
Args: game_id (int): The game ID.
Returns: dict: Linescore information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| game_id | Yes |
Implementation Reference
- mlb_api.py:518-534 (handler)The handler function implementing the logic for the get_mlb_linescore tool. It retrieves the linescore for a given game ID using the MLB API and returns it or an error.@mcp.tool() def get_mlb_linescore(game_id: int) -> dict: """ Get linescore for a specific game by game_id. Args: game_id (int): The game ID. Returns: dict: Linescore information. """ try: linescore = mlb.get_game_line_score(game_id) return linescore except Exception as e: return {"error": str(e)}
- main.py:22-22 (registration)Invocation of setup_mlb_tools(mcp) in the main server file, which defines and registers the get_mlb_linescore tool (and other MLB tools) with the MCP server.setup_mlb_tools(mcp)