Skip to main content
Glama
guillochon

mlb-api-mcp

get_current_date

Retrieve the current date in YYYY-MM-DD format for use with MLB statistics and baseball data operations.

Instructions

Get the current date.

Returns: str: The current date in YYYY-MM-DD format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_current_date' MCP tool. It uses @mcp.tool() decorator to define and register the tool logic, returning the current date in YYYY-MM-DD format or an error message.
    @mcp.tool()
    def get_current_date() -> str:
        """Get the current date.
    
        Returns:
            str: The current date in YYYY-MM-DD format
        """
        try:
            current_date = datetime.now().strftime("%Y-%m-%d")
            return current_date
        except Exception as e:
            return f"Error getting current date: {e!s}"
  • main.py:23-23 (registration)
    The call to setup_generic_tools(mcp) in the main server setup, which executes the tool definitions including get_current_date.
    setup_generic_tools(mcp)
  • The docstring in the get_current_date handler defines the tool's description and output schema (str in YYYY-MM-DD format).
    """Get the current date.
    
    Returns:
        str: The current date in YYYY-MM-DD format
    """
  • The setup_generic_tools function that contains the definitions of generic tools including get_current_date.
    def setup_generic_tools(mcp):
        """Setup generic tools for the MCP server"""

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