get_mlb_search_players
Search MLB players by name to retrieve detailed statistics and player data for baseball analysis and applications.
Instructions
Search for players by name.
Args: fullname (str): Player name to search for. sport_id (int): Sport ID (default: 1 for MLB). search_key (str): Search key (default: "fullname").
Returns: dict: Player search results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullname | Yes | ||
| sport_id | No | ||
| search_key | No | fullname |
Implementation Reference
- mlb_api.py:579-596 (handler)The handler function for the 'get_mlb_search_players' tool, decorated with @mcp.tool(). It searches for MLB players by fullname using the mlbstatsapi library and returns player IDs or an error.@mcp.tool() def get_mlb_search_players(fullname: str, sport_id: int = 1, search_key: str = "fullname") -> dict: """ Search for players by name. Args: fullname (str): Player name to search for. sport_id (int): Sport ID (default: 1 for MLB). search_key (str): Search key (default: "fullname"). Returns: dict: Player search results. """ try: player_ids = mlb.get_people_id(fullname, sport_id=sport_id, search_key=search_key) return {"player_ids": player_ids} except Exception as e: return {"error": str(e)}
- main.py:22-22 (registration)Calls setup_mlb_tools(mcp) which defines and registers the get_mlb_search_players tool (and other MLB tools) on the MCP server instance.setup_mlb_tools(mcp)