get_mlb_player_info
Retrieve detailed player information by ID using a FastAPI-based MLB data integration tool. Enables access to baseball statistics and player data for AI applications and analysis.
Instructions
Get information about a specific player by ID.
Args: player_id (int): The player ID.
Returns: dict: Player information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player_id | Yes |
Implementation Reference
- mlb_api.py:353-369 (handler)The handler function decorated with @mcp.tool() that implements the core logic for retrieving MLB player information by player ID using the mlbstatsapi library.@mcp.tool() def get_mlb_player_info(player_id: int) -> dict: """ Get information about a specific player by ID. Args: player_id (int): The player ID. Returns: dict: Player information. """ try: player_info = mlb.get_person(player_id) return {"player_info": player_info} 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 the get_mlb_player_info tool along with other MLB tools.setup_mlb_tools(mcp)