get_current_datetime
Retrieve the current system date and time for comparing with cart checkout dates, order history, and time-sensitive operations.
Instructions
Get the current system date and time.
This tool is useful for comparing with cart checkout dates, order history,
or any other time-sensitive operations.
Returns:
Dictionary containing current date and time information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The asynchronous handler function that executes the tool logic, fetching and formatting the current datetime in various formats including ISO, date, time, timestamp, and human-readable string.async def get_current_datetime(ctx: Context = None) -> Dict[str, Any]: """ Get the current system date and time. This tool is useful for comparing with cart checkout dates, order history, or any other time-sensitive operations. Returns: Dictionary containing current date and time information """ now = datetime.now() return { "success": True, "datetime": now.isoformat(), "date": now.date().isoformat(), "time": now.time().isoformat(), "timestamp": int(now.timestamp()), "formatted": now.strftime("%A, %B %d, %Y at %I:%M:%S %p") }
- src/kroger_mcp/tools/utility_tools.py:10-13 (registration)The register_tools function in the utility_tools module where the get_current_datetime tool is defined and registered using the @mcp.tool() decorator.def register_tools(mcp): """Register utility tools with the FastMCP server""" @mcp.tool()
- src/kroger_mcp/server.py:77-77 (registration)The invocation of utility_tools.register_tools(mcp) in the create_server function, which triggers the registration of the get_current_datetime tool.utility_tools.register_tools(mcp)