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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- generic_api.py:20-31 (handler)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}"
- generic_api.py:22-26 (schema)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 """