Skip to main content
Glama
aliyun

Alibaba Cloud MCP Server

Official
by aliyun

GetCpuUsageData

Retrieve CPU usage data for Alibaba Cloud ECS instances to monitor performance and optimize resource allocation. Specify region and instance IDs for accurate, actionable insights.

Instructions

获取ECS实例的CPU使用率数据

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
InstanceIdsYesAlibabaCloud ECS instance ID List
RegionIdNoAlibabaCloud region IDcn-hangzhou

Implementation Reference

  • The main handler function for the CMS_GetCpuUsageData tool, which retrieves CPU usage data ('cpu_total' metric) for specified ECS instance IDs in a given Alibaba Cloud region using the CMS API.
    def CMS_GetCpuUsageData(
        InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'),
        RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou')
    ):
        """获取ECS实例的CPU使用率数据"""
        return _get_cms_metric_data(RegionId, InstanceIds, 'cpu_total')
  • Supporting helper function that fetches the last metric data points from Alibaba Cloud CMS for given instance IDs and metric name, used by CPU usage and other metric tools.
    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)
        logger.info(f'CMS Tools response: {describe_metric_last_resp.body}')
        return describe_metric_last_resp.body.datapoints
  • Code that registers all tools from cms_tools (including CMS_GetCpuUsageData) with the FastMCP server instance.
    for tool in cms_tools.tools:
        mcp.tool(tool)
  • Helper function to create a CMS client configured for the specified region endpoint.
    def create_client(region_id: str) -> cms20190101Client:
        config = create_config()
        config.endpoint = f'metrics.{region_id}.aliyuncs.com'
        return cms20190101Client(config)
  • Import statement that brings in the cms_tools module containing the tool definitions and tools list.
    from alibaba_cloud_ops_mcp_server.tools import cms_tools, oos_tools, oss_tools, api_tools, common_api_tools
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on permissions required, rate limits, data freshness, error handling, or output format. For a data retrieval tool in a cloud environment, this omission is significant and leaves the agent guessing about operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose, making it easy to parse quickly, though it could benefit from more detail given the lack of annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of cloud resource monitoring, no annotations, and no output schema, the description is incomplete. It doesn't explain what the returned data looks like (e.g., time series, averages, granularity), error conditions, or how it interacts with sibling tools, leaving gaps for effective agent use in a rich toolset environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters (InstanceIds as an array of ECS instance IDs, RegionId with a default). The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints, but the schema itself is well-documented, meeting the baseline for adequate coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('获取' meaning 'get') and resource ('ECS实例的CPU使用率数据' meaning 'ECS instance CPU usage data'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like GetCpuloadavgData or GetMemUsageData, but the specificity of 'CPU使用率' (CPU usage rate) provides some implicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like GetCpuloadavgData (which might provide load averages) or GetMemUsageData (for memory), nor does it specify prerequisites, constraints, or appropriate contexts for usage beyond the basic function.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/aliyun/alibabacloud-ecs-mcp-server'

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