get_current_tenant
Retrieve the current tenant name from OceanBase using the MCP server mcp-oceanbase, simplifying tenant identification for database management.
Instructions
Get the current tenant name from oceanbase.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Handler function for the 'get_current_tenant' MCP tool. It queries the OceanBase database for tenant names and IDs using execute_sql. The @app.tool() decorator registers it as a tool.@app.tool() def get_current_tenant() -> str: """ Get the current tenant name from oceanbase. """ logger.info("Calling tool: get_current_tenant") sql_query = "SELECT TENANT_NAME,TENANT_ID FROM oceanbase.DBA_OB_TENANTS" try: return execute_sql(sql_query) except Error as e: logger.error(f"Error executing SQL '{sql_query}': {e}") return f"Error executing query: {str(e)}"
- src/oceanbase_mcp_server/oceanbase_mcp/server.py:239-239 (registration)The @app.tool() decorator registers the get_current_tenant function as an MCP tool.@app.tool()