Skip to main content
Glama

get_mlb_search_players

Search for MLB players by name using a specified sport ID and search key. Retrieve player data in JSON format for integration with AI applications or baseball analysis tools.

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
NameRequiredDescriptionDefault
fullnameYes
search_keyNofullname
sport_idNo

Implementation Reference

  • The main handler function for the 'get_mlb_search_players' 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)
    Registers all MLB tools, including 'get_mlb_search_players', by calling setup_mlb_tools which defines functions decorated with @mcp.tool().
    setup_mlb_tools(mcp)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/guillochon/mlb-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server