Skip to main content
Glama
RadiumGu

Alibaba Cloud Operations MCP Server

by RadiumGu

reboot_ecs_instances

Restart ECS instances on Alibaba Cloud by specifying region and instance IDs. Ideal for managing server performance or troubleshooting.

Instructions

重启ECS实例

Args: region: 区域ID,如cn-beijing instance_ids: ECS实例ID列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idsNo
regionNocn-beijing

Implementation Reference

  • Handler and registration for the 'reboot_ecs_instances' MCP tool via @app.tool() decorator. Dynamically invokes the underlying OOS_RebootInstances helper from oos_tools.
    @app.tool() def reboot_ecs_instances(region: str = "cn-beijing", instance_ids: List[str] = None) -> str: """重启ECS实例 Args: region: 区域ID,如cn-beijing instance_ids: ECS实例ID列表 """ try: sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'alibaba_cloud_ops_mcp_server')) from tools import oos_tools if not instance_ids: return "请提供ECS实例ID列表" for tool_func in oos_tools.tools: if hasattr(tool_func, '__name__') and 'reboot' in tool_func.__name__.lower() and 'instance' in tool_func.__name__.lower(): result = tool_func(RegionId=region, InstanceIds=instance_ids) return str(result) return f"ECS实例重启功能可用,region: {region}, 实例: {instance_ids}" except Exception as e: return f"ECS实例重启失败: {str(e)}"
  • Core implementation logic for rebooting ECS instances using Alibaba Cloud OOS (Operation Orchestration Service) template 'ACS-ECS-BulkyRebootInstances'. Includes Pydantic-based input schema definitions.
    @tools.append def OOS_RebootInstances( InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'), RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'), ForeceStop: bool = Field(description='Is forced shutdown required', default=False) ): """批量重启ECS实例,适用于需要同时管理和重启多台ECS实例的场景。""" parameters = { 'regionId': RegionId, 'resourceType': 'ALIYUN::ECS::Instance', 'targets': { 'ResourceIds': InstanceIds, 'RegionId': RegionId, 'Type': 'ResourceIds' }, 'forceStop': ForeceStop } return _start_execution_sync(region_id=RegionId, template_name='ACS-ECS-BulkyRebootInstances', parameters=parameters)
  • Shared utility helper function that synchronously starts and monitors OOS execution, used by OOS_RebootInstances and other OOS tools.
    def _start_execution_sync(region_id: str, template_name: str, parameters: dict): client = create_client(region_id=region_id) start_execution_request = oos_20190601_models.StartExecutionRequest( region_id=region_id, template_name=template_name, parameters=json.dumps(parameters) ) start_execution_resp = client.start_execution(start_execution_request) execution_id = start_execution_resp.body.execution.execution_id while True: list_executions_request = oos_20190601_models.ListExecutionsRequest( region_id=region_id, execution_id=execution_id ) list_executions_resp = client.list_executions(list_executions_request) status = list_executions_resp.body.executions[0].status if status == FAILED: status_message = list_executions_resp.body.executions[0].status_message raise exception.OOSExecutionFailed(reason=status_message) elif status in END_STATUSES: return list_executions_resp.body time.sleep(1) @tools.append

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RadiumGu/alicloud-ops-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server