@@ -1299,6 +1299,57 @@ async def modify_security_ips(
12991299 raise OpenAPIError (f"modify rds instance security ips failed: { str (e )} " )
13001300
13011301
1302+ @mcp .tool ()
1303+ async def restart_db_instance (
1304+ region_id : str ,
1305+ dbinstance_id : str ,
1306+ effective_time : str = "Immediate" ,
1307+ switch_time : str = None ,
1308+ client_token : str = None
1309+ ) -> Dict [str , Any ]:
1310+ """Restart an RDS instance.
1311+
1312+ Args:
1313+ region_id (str): The region ID of the RDS instance.
1314+ dbinstance_id (str): The ID of the RDS instance.
1315+ effective_time (str, optional): When to restart the instance. Options:
1316+ - Immediate: Restart immediately
1317+ - MaintainTime: Restart during maintenance window
1318+ - ScheduleTime: Restart at specified time
1319+ Default: Immediate
1320+ switch_time (str, optional): The scheduled restart time in format: yyyy-MM-ddTHH:mm:ssZ (UTC time).
1321+ Required when effective_time is ScheduleTime.
1322+ client_token (str, optional): Idempotency token, max 64 ASCII characters.
1323+
1324+ Returns:
1325+ Dict[str, Any]: Response containing the request ID.
1326+ """
1327+ try :
1328+ # Initialize client
1329+ client = get_rds_client (region_id )
1330+
1331+ # Create request
1332+ request = rds_20140815_models .RestartDBInstanceRequest (
1333+ dbinstance_id = dbinstance_id
1334+ )
1335+
1336+ # Add optional parameters
1337+ if effective_time :
1338+ request .effective_time = effective_time
1339+ if switch_time :
1340+ request .switch_time = switch_time
1341+ if client_token :
1342+ request .client_token = client_token
1343+
1344+ # Make the API request
1345+ response = client .restart_dbinstance (request )
1346+ return response .body .to_map ()
1347+
1348+ except Exception as e :
1349+ logger .error (f"Error occurred while restarting instance: { str (e )} " )
1350+ raise OpenAPIError (f"Failed to restart RDS instance: { str (e )} " )
1351+
1352+
13021353def main ():
13031354 mcp .run (transport = os .getenv ('SERVER_TRANSPORT' , 'stdio' ))
13041355
0 commit comments