Skip to main content
Glama
guillochon

mlb-api-mcp

get_mlb_awards

Retrieve MLB award recipients by specifying an award ID to access baseball award data through the MLB API MCP server.

Instructions

Get award recipients for a specific award.

Args: award_id (int): Award ID.

Returns: dict: Award recipients.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
award_idYes

Implementation Reference

  • The core handler function for the 'get_mlb_awards' tool. It is decorated with @mcp.tool(), which registers it with the MCP server. The function fetches award data using the mlbstatsapi library and handles errors.
    @mcp.tool()
    def get_mlb_awards(award_id: int) -> dict:
        """
        Get award recipients for a specific award.
    
        Args:
            award_id (int): Award ID.
    
        Returns:
            dict: Award recipients.
        """
        try:
            awards = mlb.get_awards(award_id)
            return {"awards": awards}
        except Exception as e:
            return {"error": str(e)}
  • main.py:22-23 (registration)
    The call to setup_mlb_tools(mcp) in main.py, which executes the function definitions and @mcp.tool() decorators, thereby registering the 'get_mlb_awards' tool (along with other MLB tools) to the FastMCP server instance.
    setup_mlb_tools(mcp)
    setup_generic_tools(mcp)
  • The input schema (award_id: int) and output description defined in the tool's docstring, used by MCP for validation.
    Args:
        award_id (int): Award ID.
    
    Returns:
        dict: Award recipients.
    """

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