Skip to main content
Glama
RadiumGu

Alibaba Cloud Operations MCP Server

by RadiumGu

get_disk_usage_data

Retrieve disk usage data for Alibaba Cloud ECS instances by specifying region and instance IDs. Monitor and analyze storage metrics to optimize resource allocation and performance.

Instructions

获取ECS实例磁盘使用率数据

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idsNo
regionNocn-beijing

Implementation Reference

  • Primary MCP tool handler registered with @app.tool(). Dynamically imports cms_tools and invokes the matching disk usage function (CMS_GetDiskUsageData) by name keywords.
    def get_disk_usage_data(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 cms_tools if not instance_ids: instance_ids = ["示例实例ID"] for tool_func in cms_tools.tools: if hasattr(tool_func, '__name__') and 'disk' in tool_func.__name__.lower() and 'usage' in tool_func.__name__.lower(): result = tool_func(RegionId=region, InstanceIds=instance_ids) return str(result) return f"磁盘使用率监控功能可用,region: {region}, 实例: {instance_ids}" except Exception as e: return f"磁盘监控查询失败: {str(e)}"
  • Helper function registered to cms_tools.tools list via @tools.append. Defines input schema with Pydantic Field and calls the core metric data fetcher for disk utilization.
    @tools.append def CMS_GetDiskUsageData( InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'), RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou') ): """获取磁盘利用率指标数据""" return _get_cms_metric_data(RegionId, InstanceIds, 'diskusage_utilization')
  • Core implementation that creates CMS client and calls DescribeMetricLast API to retrieve the last metric datapoints for the given instances and metric.
    def _get_cms_metric_data(region_id: str, instance_ids: List[str], metric_name: str): client = create_client(region_id) dimesion = [] for instance_id in instance_ids: dimesion.append({ 'instanceId': instance_id }) describe_metric_last_request = cms_20190101_models.DescribeMetricLastRequest( namespace='acs_ecs_dashboard', metric_name=metric_name, dimensions=json.dumps(dimesion), ) describe_metric_last_resp = client.describe_metric_last(describe_metric_last_request) return describe_metric_last_resp.body.datapoints
  • Pydantic Field definitions providing input schema and descriptions for the underlying CMS_GetDiskUsageData function.
    InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'), RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou')
  • @app.tool() decorator registers the get_disk_usage_data function as an MCP tool.
    def get_disk_usage_data(region: str = "cn-beijing", instance_ids: List[str] = None) -> str:

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