Skip to main content
Glama

get_current_time

Retrieve the current time in HH:MM:SS format for time-sensitive operations or synchronization tasks within the MLB API MCP server.

Instructions

Get the current time.

Returns: str: The current time in HH:MM:SS format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_current_time' tool. It returns the current time in HH:MM:SS format using datetime.now(), with error handling.
    @mcp.tool() def get_current_time() -> str: """Get the current time. Returns: str: The current time in HH:MM:SS format """ try: current_time = datetime.now().strftime("%H:%M:%S") return current_time except Exception as e: return f"Error getting current time: {e!s}"
  • generic_api.py:4-32 (registration)
    The setup_generic_tools function registers the 'get_current_time' tool (along with get_current_date) using the @mcp.tool() decorator inside the function body.
    def setup_generic_tools(mcp): """Setup generic tools for the MCP server""" @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}" @mcp.tool() def get_current_time() -> str: """Get the current time. Returns: str: The current time in HH:MM:SS format """ try: current_time = datetime.now().strftime("%H:%M:%S") return current_time except Exception as e: return f"Error getting current time: {e!s}"
  • The docstring schema defining the tool's purpose and return type for MCP validation.
    """Get the current time. Returns: str: The current time in HH:MM:SS format """

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