Skip to main content
Glama

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
NameRequiredDescriptionDefault

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") }
  • 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()
  • 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)

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/CupOfOwls/kroger-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server