Skip to main content
Glama
RadiumGu

Alibaba Cloud Operations MCP Server

by RadiumGu

stop_ecs_instances

Stop ECS instances on Alibaba Cloud by specifying the region and instance IDs, ensuring efficient resource management and cost control.

Instructions

停止ECS实例

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idsNo
regionNocn-beijing

Implementation Reference

  • The main handler function for the 'stop_ecs_instances' MCP tool. It is registered via @app.tool() decorator and delegates to the OOS_StopInstances helper from oos_tools by matching function name patterns.
    @app.tool() def stop_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 'stop' 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 helper function OOS_StopInstances invoked by the handler. Uses Alibaba Cloud OOS to bulk stop ECS instances via the 'ACS-ECS-BulkyStopInstances' template, with Pydantic Field definitions serving as input schema.
    @tools.append def OOS_StopInstances( 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-BulkyStopInstances', parameters=parameters)

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