Skip to main content
Glama
guillochon

mlb-api-mcp

get_mlb_boxscore

Retrieve detailed MLB game statistics by providing a game ID, with options to filter by specific timecodes or data fields for targeted analysis.

Instructions

Get boxscore for a specific game by game_id.

Args: game_id (int): The game ID. timecode (Optional[str]): Specific timecode for the boxscore snapshot. fields (Optional[str]): Comma-separated list of fields to include.

Returns: dict: Boxscore information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
game_idYes
timecodeNo
fieldsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_mlb_boxscore' tool. It retrieves the boxscore for a given game ID using the mlbstatsapi.Mlb().get_game_box_score method, with optional timecode and fields parameters. Errors are caught and returned as a dict.
    @mcp.tool()
    def get_mlb_boxscore(game_id: int, timecode: Optional[str] = None, fields: Optional[str] = None) -> dict:
        """
        Get boxscore for a specific game by game_id.
    
        Args:
            game_id (int): The game ID.
            timecode (Optional[str]): Specific timecode for the boxscore snapshot.
            fields (Optional[str]): Comma-separated list of fields to include.
    
        Returns:
            dict: Boxscore information.
        """
        try:
            params = {}
            if timecode is not None:
                params["timecode"] = timecode
            if fields is not None:
                params["fields"] = fields
            boxscore = mlb.get_game_box_score(game_id, **params)
            return boxscore
        except Exception as e:
            return {"error": str(e)}
  • main.py:22-22 (registration)
    Registers the get_mlb_boxscore tool (and other MLB tools) by calling setup_mlb_tools(mcp), which defines the tool functions decorated with @mcp.tool().
    setup_mlb_tools(mcp)
  • main.py:12-12 (registration)
    Imports the setup_mlb_tools function used to register the MLB tools including get_mlb_boxscore.
    from mlb_api import setup_mlb_tools
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it 'returns dict: Boxscore information' which gives some behavioral context about the return type, but doesn't disclose important traits like whether this is a read-only operation, potential rate limits, authentication needs, or what happens with invalid game_ids. For a tool with no annotations, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Args, Returns) and front-loads the core purpose. The 'Args' and 'Returns' sections are helpful but could be more integrated. Every sentence serves a purpose, though the parameter explanations could be slightly more detailed given the schema coverage gap.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), 3 parameters with 0% schema coverage, and no annotations, the description does reasonably well. It explains all parameters and the return type, though it could better address behavioral aspects like error conditions or data freshness given the timecode parameter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds meaningful context for all 3 parameters: game_id's purpose, timecode as a 'snapshot' indicator, and fields as a comma-separated list. However, it doesn't provide format details (e.g., timecode format, available field options) or examples that would fully compensate for the schema coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'boxscore for a specific game by game_id', making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like get_mlb_linescore or get_mlb_game_scoring_plays, which also provide game-related data but for different aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention when this tool is appropriate compared to sibling tools like get_mlb_linescore (which might provide summary scoring) or get_mlb_game_scoring_plays (which might provide play-by-play details).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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