describe_available_classes
Query available RDS instance classes and storage options for purchase based on region, engine type, payment model, and configuration requirements.
Instructions
Query the RDS instance class_code and storage space that can be purchased in the inventory.
Args:
region_id: The region ID of the RDS instance.
zone_id: The zone ID of the RDS instance. Query available zones by `describe_available_zones`.
instance_charge_type: Instance payment type. Values: Prepaid, Postpaid, Serverless.
engine: Database engine type. Values: MySQL, SQLServer, PostgreSQL, MariaDB.
engine_version: Database version.
dbinstance_storage_type: Storage type. Values: local_ssd,general_essd,cloud_essd,cloud_essd2,cloud_essd3
category: Instance category. Values: Basic, HighAvailability, cluster, AlwaysOn, Finance, serverless_basic, serverless_standard, serverless_ha.
dbinstance_id: The ID of the RDS instance.
order_type: Order type. Currently only supports "BUY".
commodity_code: Commodity code for read-only instances.
Returns:
Dict[str, Any]: The response containing available instance classes and storage ranges.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region_id | Yes | ||
| zone_id | Yes | ||
| instance_charge_type | Yes | ||
| engine | Yes | ||
| engine_version | Yes | ||
| dbinstance_storage_type | Yes | ||
| category | Yes | ||
| dbinstance_id | No | ||
| order_type | No | ||
| commodity_code | No |
Implementation Reference
- The main handler function implementing the 'describe_available_classes' tool. It calls the Alibaba Cloud RDS API to query available instance classes and storage spaces based on parameters like region, zone, engine, etc. The function is decorated with @mcp.tool() for registration in the MCP server.async def describe_available_classes( region_id: str, zone_id: str, instance_charge_type: str, engine: str, engine_version: str, dbinstance_storage_type: str, category: str, dbinstance_id: str = None, order_type: str = None, commodity_code: str = None ) -> Dict[str, Any]: """Query the RDS instance class_code and storage space that can be purchased in the inventory. Args: region_id: The region ID of the RDS instance. zone_id: The zone ID of the RDS instance. Query available zones by `describe_available_zones`. instance_charge_type: Instance payment type. Values: Prepaid, Postpaid, Serverless. engine: Database engine type. Values: MySQL, SQLServer, PostgreSQL, MariaDB. engine_version: Database version. dbinstance_storage_type: Storage type. Values: local_ssd,general_essd,cloud_essd,cloud_essd2,cloud_essd3 category: Instance category. Values: Basic, HighAvailability, cluster, AlwaysOn, Finance, serverless_basic, serverless_standard, serverless_ha. dbinstance_id: The ID of the RDS instance. order_type: Order type. Currently only supports "BUY". commodity_code: Commodity code for read-only instances. Returns: Dict[str, Any]: The response containing available instance classes and storage ranges. """ try: # Initialize the client client = get_rds_client(region_id) # Create request request = rds_20140815_models.DescribeAvailableClassesRequest( region_id=region_id, zone_id=zone_id, instance_charge_type=instance_charge_type, engine=engine, engine_version=engine_version, dbinstance_storage_type=dbinstance_storage_type, category=category ) # Add optional parameters if provided if dbinstance_id: request.dbinstance_id = dbinstance_id if order_type: request.order_type = order_type if commodity_code: request.commodity_code = commodity_code # Make the API request response = client.describe_available_classes(request) return response.body.to_map() except Exception as e: logger.error(f"Error occurred while querying available classes: {str(e)}") raise OpenAPIError(f"Failed to query available instance classes: {str(e)}")