reload_config
Reload configuration settings in MariaDB MCP Server from environment variables and .env file to ensure updated parameters are applied.
Instructions
Reload configuration from environment variables and .env file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mariadb_mcp/server.py:157-180 (handler)The main handler function for the 'reload_config' tool. It is registered via the @mcp.tool() decorator. The function closes the existing database connection pool, reloads the configuration from environment variables, updates the global db_connection instance with new parameters, and resets the pool to force reconnection on the next operation.async def reload_config() -> str: """Reload configuration from environment variables and .env file.""" try: # Close existing connection pool await db_connection.close() # Reload configuration config_manager.reload() # Update connection parameters db_connection.host = config_manager.get('host') db_connection.port = config_manager.get('port') db_connection.user = config_manager.get('user') db_connection.password = config_manager.get('password') db_connection.database = config_manager.get('database') db_connection.pool = None # Reset pool to force reconnection logger.info("Configuration reloaded successfully") return "Configuration reloaded successfully. New connection will be established on next database operation." except Exception as e: logger.error(f"Error reloading configuration: {e}") return f"Error reloading configuration: {str(e)}"