Skip to main content
Glama
guillochon

mlb-api-mcp

get_mlb_search_players

Search MLB players by name to retrieve detailed statistics and player data for baseball analysis and applications.

Instructions

Search for players by name.

Args: fullname (str): Player name to search for. sport_id (int): Sport ID (default: 1 for MLB). search_key (str): Search key (default: "fullname").

Returns: dict: Player search results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullnameYes
sport_idNo
search_keyNofullname

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_mlb_search_players' tool, decorated with @mcp.tool(). It searches for MLB players by fullname using the mlbstatsapi library and returns player IDs or an error.
    @mcp.tool()
    def get_mlb_search_players(fullname: str, sport_id: int = 1, search_key: str = "fullname") -> dict:
        """
        Search for players by name.
    
        Args:
            fullname (str): Player name to search for.
            sport_id (int): Sport ID (default: 1 for MLB).
            search_key (str): Search key (default: "fullname").
    
        Returns:
            dict: Player search results.
        """
        try:
            player_ids = mlb.get_people_id(fullname, sport_id=sport_id, search_key=search_key)
            return {"player_ids": player_ids}
        except Exception as e:
            return {"error": str(e)}
  • main.py:22-22 (registration)
    Calls setup_mlb_tools(mcp) which defines and registers the get_mlb_search_players tool (and other MLB tools) on the MCP server instance.
    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 of behavioral disclosure. It mentions the tool searches by name and returns results, but doesn't cover critical aspects like whether it's read-only, potential rate limits, authentication needs, or error handling. For a search tool with zero annotation coverage, this is a significant gap.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded with the core purpose, followed by structured sections for Args and Returns. Every sentence earns its place with no wasted words, making it easy to scan and understand.

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 moderate complexity (3 parameters, 1 required), no annotations, and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the purpose and parameters well, but could improve by addressing behavioral aspects like search scope or limitations.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics by explaining that 'fullname' is the player name to search for, 'sport_id' defaults to 1 for MLB, and 'search_key' defaults to 'fullname.' This clarifies parameter purposes beyond the bare schema, though it doesn't detail possible values or constraints.

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 as 'Search for players by name,' which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_mlb_players' or 'get_mlb_player_info,' which might also retrieve player data, so it falls short of a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives, such as 'get_mlb_players' (which might list all players) or 'get_mlb_player_info' (which might retrieve detailed info for a specific player). It lacks explicit when/when-not instructions or named alternatives.

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