Skip to main content
Glama
guillochon

mlb-api-mcp

get_mlb_teams

Retrieve MLB team data by specifying sport ID and optional season year for comprehensive baseball statistics integration.

Instructions

Get all teams for a specific sport.

Args: sport_id (int): Sport ID (default: 1 for MLB). season (Optional[int]): Filter teams by a specific season (year).

Returns: dict: All teams for the specified sport.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sport_idNo
seasonNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers and implements the get_mlb_teams tool. It retrieves MLB teams data using the mlb library, supporting optional season filtering, and returns teams or error.
    @mcp.tool()
    def get_mlb_teams(sport_id: int = 1, season: Optional[int] = None) -> dict:
        """
        Get all teams for a specific sport.
    
        Args:
            sport_id (int): Sport ID (default: 1 for MLB).
            season (Optional[int]): Filter teams by a specific season (year).
    
        Returns:
            dict: All teams for the specified sport.
        """
        try:
            params = {}
            if season is not None:
                params["season"] = season
            teams = mlb.get_teams(sport_id=sport_id, **params)
            return {"teams": teams}
        except Exception as e:
            return {"error": str(e)}
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 states the tool fetches data ('Get all teams') and mentions a default value for sport_id, but fails to disclose critical traits like whether it's read-only (implied but not stated), potential rate limits, authentication needs, error handling, or pagination behavior. For a data retrieval 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. The first sentence states the core purpose, followed by structured sections for Args and Returns. Every sentence adds value: the purpose, parameter explanations, and return type. There is no redundant or verbose content, making it efficient and easy to parse.

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 (2 parameters, no nested objects) and the presence of an output schema (which handles return values), the description is largely complete. It covers the purpose, parameters, and return type. However, it lacks behavioral context (e.g., safety, limits) and explicit usage guidelines, which are minor gaps in an otherwise adequate description for this simple tool.

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?

The description adds meaningful semantics beyond the input schema. With 0% schema description coverage, the schema only defines types and defaults. The description explains that 'sport_id' defaults to 1 for MLB and 'season' filters teams by year, clarifying the purpose and usage of parameters that are otherwise undocumented. It compensates well for the low schema coverage, though it doesn't detail all 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: 'Get all teams for a specific sport.' It specifies the verb ('Get') and resource ('teams'), and distinguishes it from siblings like 'get_mlb_team_info' (which likely fetches details for a single team) and 'get_mlb_search_teams' (which likely involves search queries). However, it doesn't explicitly differentiate from all siblings, such as 'get_mlb_roster' (which might list players per team), keeping it from 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 Guidelines3/5

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

Usage guidelines are implied but not explicit. The description mentions filtering by sport and season, suggesting it's for retrieving team lists rather than detailed info or searches. However, it lacks clear when-to-use directives, such as advising to use 'get_mlb_team_info' for individual team details or 'get_mlb_search_teams' for filtered searches, leaving some ambiguity.

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