Skip to main content
Glama
oceanbase

mcp-oceanbase

Official
by oceanbase

get_current_time

Retrieve the current system time from the mcp-oceanbase server for accurate time synchronization and logging purposes.

Instructions

Get current time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_current_time' tool. It executes SQL 'SELECT NOW()' on OceanBase to get the current time, falling back to Python's local time if the database query fails. The @app.tool decorator registers the tool.
    @app.tool(name="get_current_time", description="Get current time")
    def get_current_time() -> str:
        """Get current time from OceanBase database."""
        logger.info("Calling tool: get_current_time")
        sql_query = "SELECT NOW()"
        try:
            return execute_sql(sql_query)
        except Error as e:
            logger.error(f"Error getting database time: {e}")
            # Fallback to system time if database query fails
            local_time = time.localtime()
            formatted_time = time.strftime("%Y-%m-%d %H:%M:%S", local_time)
            logger.info(f"Fallback to system time: {formatted_time}")
            return formatted_time

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/oceanbase/mcp-oceanbase'

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