Skip to main content
Glama

get_mlb_player_info

Retrieve detailed player information from MLB data sources by providing a player ID. This tool accesses baseball statistics and player data for integration into applications.

Instructions

Get information about a specific player by ID.

Args: player_id (int): The player ID.

Returns: dict: Player information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
player_idYes

Implementation Reference

  • The main handler function for the 'get_mlb_player_info' tool. It retrieves player information using the MLB stats API and is decorated with @mcp.tool() which handles registration in the MCP server.
    @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 initialization, which defines and registers the get_mlb_player_info tool along with other MLB tools.
    setup_mlb_tools(mcp)
  • The docstring provides the input schema (player_id: int) and output description (dict: Player information). Type hints also serve as schema.
    """ Get information about a specific player by ID. Args: player_id (int): The player ID. Returns: dict: Player information. """
  • In tests, setup_mlb_tools is called to register tools for testing purposes.
    mlb_api.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