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
| Name | Required | Description | Default |
|---|---|---|---|
| award_id | Yes |
Implementation Reference
- mlb_api.py:636-652 (handler)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)
- mlb_api.py:641-646 (schema)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. """