ydb_status
Check the current connection status of YDB databases to monitor and ensure active and stable database interactions within the YDB MCP server environment.
Instructions
Get the current status of the YDB connection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- ydb_mcp/server.py:660-702 (handler)The primary handler function that executes the ydb_status tool logic. It checks the YDB driver status, performs discovery details check, and returns formatted JSON status including connection state, endpoint, database, auth mode, and any errors.async def get_connection_status(self) -> List[TextContent]: """Get the current status of the YDB connection. Returns: List of TextContent objects """ connection_status = "disconnected" error_message = None try: # Force create driver to ensure up-to-date status if self.driver is None: logger.info("Creating new driver for connection status check") await self.create_driver() if self.driver: try: discovery = self.driver.discovery_debug_details() if discovery.startswith("Resolved endpoints"): connection_status = "connected" else: error_message = f"Discovery error: {discovery}" except Exception as conn_error: error_message = f"Error checking connection via discovery: {conn_error}" else: error_message = "No driver available for connection status check" except Exception as e: error_message = str(e) status_info = { "status": "running", "ydb_endpoint": self.endpoint, "ydb_database": self.database, "auth_mode": self.auth_mode, "ydb_connection": connection_status, "error": error_message, } # Format the result as a TextContent object safe_status = self._stringify_dict_keys(status_info) formatted_result = json.dumps(safe_status, indent=2, cls=CustomJSONEncoder) logger.info(f"Connection status: {formatted_result}") return [TextContent(type="text", text=formatted_result)]
- ydb_mcp/server.py:612-658 (registration)The tool registration block in register_tools() method. Defines the ydb_status tool specification (name, description, handler, parameters schema) in tool_specs list and registers it with both FastMCP.add_tool() and ToolManager.register_tool().{ "name": "ydb_status", "description": "Get the current status of the YDB connection", "handler": self.get_connection_status, # Use real handler "parameters": {"type": "object", "properties": {}, "required": []}, }, { "name": "ydb_list_directory", "description": "List directory contents in YDB", "handler": self.list_directory, "parameters": { "properties": {"path": {"type": "string", "title": "Path"}}, "required": ["path"], "type": "object", }, }, { "name": "ydb_describe_path", "description": "Get detailed information about a YDB path (table, directory, etc.)", "handler": self.describe_path, "parameters": { "properties": {"path": {"type": "string", "title": "Path"}}, "required": ["path"], "type": "object", }, }, ] # Register all tools with FastMCP framework for spec in tool_specs: self.add_tool( spec["handler"], name=spec["name"], description=spec["description"], # Structured output is temporarily disabled until proper schema definitions are implemented. # See https://github.com/ydb-platform/ydb-mcp/issues/12 for details. structured_output=False, ) # Also register with our tool manager self.tool_manager.register_tool( name=spec["name"], handler=spec["handler"], description=spec["description"], parameters=spec.get("parameters"), )
- ydb_mcp/server.py:616-616 (schema)The input parameters schema for ydb_status tool, which takes no parameters (empty properties)."parameters": {"type": "object", "properties": {}, "required": []},
- ydb_mcp/server.py:1064-1066 (handler)Dispatch logic in the overridden call_tool() method that specially handles ydb_status by directly calling the handler.elif tool_name == "ydb_status": result = await self.get_connection_status() elif tool_name == "ydb_list_directory" and "path" in params: