Skip to main content
Glama
guillochon

mlb-api-mcp

get_mlb_draft

Retrieve MLB draft data for a specified year to access player selections and draft details.

Instructions

Get draft information for a specific year.

Args: year_id (int): Draft year.

Returns: dict: Draft information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
year_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_mlb_draft' tool. It is decorated with @mcp.tool(), accepts a year_id parameter, fetches MLB draft data using the mlbstatsapi library, and returns it wrapped in a dictionary or an error message.
    @mcp.tool()
    def get_mlb_draft(year_id: int) -> dict:
        """
        Get draft information for a specific year.
    
        Args:
            year_id (int): Draft year.
    
        Returns:
            dict: Draft information.
        """
        try:
            draft = mlb.get_draft(year_id)
            return {"draft": draft}
        except Exception as e:
            return {"error": str(e)}
  • main.py:19-23 (registration)
    Registers the 'get_mlb_draft' tool (along with other MLB tools) by calling setup_mlb_tools(mcp), which defines and registers the tool functions using the MCP decorator.
    mcp = FastMCP("MLB API MCP Server")
    
    # Setup all MLB and generic tools
    setup_mlb_tools(mcp)
    setup_generic_tools(mcp)
  • The function signature and docstring define the input schema (year_id: int) and output (dict with 'draft' or 'error'), used by MCP for tool schema.
    @mcp.tool()
    def get_mlb_draft(year_id: int) -> dict:
        """
        Get draft information for a specific year.
    
        Args:
            year_id (int): Draft year.
    
        Returns:
            dict: Draft information.
        """
        try:
            draft = mlb.get_draft(year_id)
            return {"draft": draft}
        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 'Get[s] draft information' and returns a 'dict,' implying a read-only operation with dictionary output, but it doesn't disclose critical traits such as authentication needs, rate limits, error handling, data freshness, or what specific draft information is included (e.g., picks, teams, players). This leaves significant gaps for an agent to understand the tool's behavior.

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 main purpose stated first ('Get draft information for a specific year.') followed by brief Arg and Return sections. Every sentence adds value, though the structure is basic and could be more streamlined (e.g., integrating Args/Returns into a single sentence). It avoids redundancy and waste, earning a high score for efficiency.

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

Completeness3/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 (1 parameter, no nested objects) and the presence of an output schema (implied by 'Returns: dict'), the description is somewhat complete but has gaps. It covers the basic purpose and parameter semantics but lacks behavioral context (e.g., no annotations, no details on output structure beyond 'dict') and usage guidelines. This makes it adequate for a simple tool but not fully informative.

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?

The input schema has 0% description coverage, with one parameter 'year_id' of type 'integer' but no further details. The description adds minimal semantics by specifying 'year_id (int): Draft year,' which clarifies the parameter's purpose as the draft year. However, it doesn't compensate fully for the schema gap—e.g., no info on valid year ranges or format—so it meets the baseline for low schema coverage without fully addressing the deficiency.

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 'Get draft information for a specific year,' which includes a specific verb ('Get') and resource ('draft information') with a scope ('for a specific year'). It distinguishes from most siblings (e.g., get_mlb_awards, get_mlb_schedule) by focusing on draft data, though it doesn't explicitly differentiate from non-draft tools like get_mlb_players or get_mlb_teams, which prevents 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. It doesn't mention prerequisites (e.g., valid year ranges), exclusions, or comparisons to sibling tools like get_mlb_players or get_mlb_teams that might overlap in data retrieval. Usage is implied only by the tool's name and purpose, lacking explicit context.

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