Skip to main content
Glama
guillochon

mlb-api-mcp

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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)
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool retrieves information, implying a read-only operation, but does not disclose behavioral traits such as authentication requirements, rate limits, error handling, or data freshness. The description lacks context beyond the basic purpose.

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 appropriately sized and front-loaded, with the purpose stated first. The 'Args' and 'Returns' sections are structured but slightly redundant since an output schema exists. Every sentence adds value, though it could be more concise by omitting the return note.

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's low complexity (one parameter) and the presence of an output schema, the description is reasonably complete. It covers the purpose and parameter basics, and the output schema handles return values. However, it lacks behavioral context and usage guidelines, which are minor gaps in this simple case.

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?

Schema description coverage is 0%, but the description adds meaning by specifying that 'player_id' is an integer and used to identify a specific player. However, it does not explain the format, range, or source of player IDs, leaving gaps in parameter understanding. With one parameter, the baseline is 4, but the lack of detailed semantics reduces the score.

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 tool's purpose: 'Get information about a specific player by ID.' It specifies the verb ('Get') and resource ('player information'), but does not distinguish it from sibling tools like 'get_mlb_players' or 'get_mlb_search_players', which might retrieve player lists or search results instead of individual player details.

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 does not mention sibling tools like 'get_mlb_players' (for lists) or 'get_mlb_search_players' (for searches), leaving the agent to infer usage based on context alone.

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