Info API Documentation
Provides API functions for retrieving server-specific information.
This module offers read-only functions to query details about individual
Bedrock server instances. It wraps methods of the
BedrockServer
class
to expose information such as:
Current runtime status (
get_server_running_status()
).Last known status from configuration (
get_server_config_status()
).Installed server version (
get_server_installed_version()
).
Each function returns a dictionary suitable for JSON serialization, indicating
the outcome of the request and the retrieved data. These are exposed to the
plugin system via
plugin_method()
.
- bedrock_server_manager.api.info.get_server_running_status(server_name: str, app_context: AppContext | None = None) Dict[str, Any]
Checks if the server process is currently running.
This function queries the operating system to determine if the Bedrock server process associated with the given server name is active by calling
is_running()
.- Parameters:
server_name (str) – The name of the server to check.
- Returns:
A dictionary with the operation result. On success:
{"status": "success", "is_running": bool}
(is_running
isTrue
if the process is active,False
otherwise). On error:{"status": "error", "message": "<error_message>"}
.- Return type:
Dict[str, Any]
- Raises:
InvalidServerNameError – If server_name is not provided.
BSMError – Can be raised by
BedrockServer
instantiation or if is_running encounters a critical issue (e.g., misconfiguration).
- bedrock_server_manager.api.info.get_server_config_status(server_name: str, app_context: AppContext | None = None) Dict[str, Any]
Gets the status from the server’s configuration file.
This function reads the ‘status’ field (e.g., ‘RUNNING’, ‘STOPPED’) from the server’s JSON configuration file via
get_status_from_config()
. Note that this reflects the last known state written to the configuration and may not match the actual live process status if the server crashed or was managed externally.- Parameters:
server_name (str) – The name of the server.
- Returns:
A dictionary with the operation result. On success:
{"status": "success", "config_status": "<status_string>"}
(e.g., “RUNNING”, “STOPPED”, “UNKNOWN”). On error:{"status": "error", "message": "<error_message>"}
.- Return type:
Dict[str, Any]
- Raises:
InvalidServerNameError – If server_name is not provided.
BSMError – Can be raised by
BedrockServer
instantiation or by the underlying configuration access methods (e.g., for file I/O or parsing errors).
- bedrock_server_manager.api.info.get_server_installed_version(server_name: str, app_context: AppContext | None = None) Dict[str, Any]
Gets the installed version from the server’s configuration file.
This function reads the ‘installed_version’ field from the server’s JSON configuration file via
get_version()
. If the version is not found or an error occurs during retrieval, it typically returns ‘UNKNOWN’.- Parameters:
server_name (str) – The name of the server.
- Returns:
A dictionary with the operation result. On success:
{"status": "success", "installed_version": "<version_string>"}
(e.g., “1.20.10.01”, “UNKNOWN”). On error:{"status": "error", "message": "<error_message>"}
.- Return type:
Dict[str, Any]
- Raises:
InvalidServerNameError – If server_name is not provided.
BSMError – Can be raised by
BedrockServer
instantiation or by the underlying configuration access methods.