Skip to main content
Glama
aliyun

Alibaba Cloud MCP Server

Official
by aliyun

DescribeInstances

Query and retrieve detailed information about instances on Alibaba Cloud ECS based on specified criteria such as region, network type, and instance status.

Instructions

本接口支持根据不同请求条件查询实例列表,并关联查询实例的详细信息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
AdditionalAttributesNo实例其他属性列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: array,参数示例:META_OPTIONS
DeviceAvailableNo>该参数正在邀测中,暂不支持使用。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
DryRunNo是否只预检此次请求。取值范围: - true:发送检查请求,不会查询资源状况。检查项包括AccessKey是否有效、RAM用户的授权情况和是否填写了必需参数。如果检查不通过,则返回对应错误。如果检查通过,会返回错误码DryRunOperation。 - false:发送正常请求,通过检查后返回2XX HTTP状态码并直接查询资源状况。 默认值:false。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
EipAddressesNo实例的弹性公网IP列表。当InstanceNetworkType=vpc时该参数生效,取值可以由多个IP组成一个JSON数组,最多支持100个IP,IP之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:["42.1.1.**", "42.1.2.**", … "42.1.10.**"]
HpcClusterIdNo实例所在的HPC集群ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:hpc-bp67acfmxazb4p****
HttpEndpointNo是否启用实例元数据的访问通道。取值范围: - enabled:启用。 - disabled:禁用。 默认值:enabled。 >有关实例元数据的更多信息,请参见[实例元数据概述](~~49122~~)。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:enabled
HttpPutResponseHopLimitNo>该参数暂未开放使用。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:0
HttpTokensNo访问实例元数据时是否强制使用加固模式(IMDSv2)。取值范围: - optional:不强制使用。 - required:强制使用。设置该取值后,普通模式无法访问实例元数据。 默认值:optional。 >有关访问实例元数据模式的更多信息,请参见[实例元数据访问模式](~~150575~~)。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:optional
ImageIdNo镜像ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:m-bp67acfmxazb4p****
InnerIpAddressesNo经典网络类型实例的内网IP列表。当InstanceNetworkType=classic时生效,取值可以由多个IP组成一个JSON数组,最多支持100个IP,IP之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:["10.1.1.1", "10.1.2.1", … "10.1.10.1"]
InstanceChargeTypeNo实例的计费方式。取值范围: - PostPaid:按量付费。 - PrePaid:包年包月。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:PostPaid
InstanceIdsNo实例ID。取值可以由多个实例ID组成一个JSON数组,最多支持100个ID,ID之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:["i-bp67acfmxazb4p****", "i-bp67acfmxazb4p****", … "i-bp67acfmxazb4p****"]
InstanceNameNo实例名称,支持使用通配符*进行模糊搜索。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:Test
InstanceNetworkTypeNo实例网络类型。取值范围: - classic:经典网络。 - vpc:专有网络VPC。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:vpc
InstanceTypeNo实例的规格。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:ecs.g5.large
InstanceTypeFamilyNo实例的规格族。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:ecs.g5
InternetChargeTypeNo公网带宽计费方式。取值范围: - PayByBandwidth:按固定带宽计费。 - PayByTraffic:按使用流量计费。 > **按使用流量计费**模式下的出入带宽峰值都是带宽上限,不作为业务承诺指标。当出现资源争抢时,带宽峰值可能会受到限制。如果您的业务需要有带宽的保障,请使用**按固定带宽计费**模式。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:PayByTraffic
IoOptimizedNo是否是I/O优化型实例。取值范围: - true:是。 - false:否。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:true
Ipv6AddressNo为弹性网卡指定的IPv6地址。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: array,参数示例:
KeyPairNameNo实例使用的SSH密钥对名称。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:KeyPairNameTest
LockReasonNo资源被锁定的原因。取值范围: - financial:因欠费被锁定。 - security:因安全原因被锁定。 - Recycling:抢占式实例的待释放锁定状态。 - dedicatedhostfinancial:因为专有宿主机欠费导致ECS实例被锁定。 - refunded:因退款被锁定。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:security
MaxResultsNo分页查询时每页行数。最大值为100。 默认值: - 当不设置值或设置的值小于10时,默认值为10。 - 当设置的值大于100时,默认值为100。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:10
NeedSaleCycleNo>该参数正在邀测中,暂不支持使用。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
NextTokenNo查询凭证(Token),取值为上一次API调用返回的`NextToken`参数值。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:caeba0bbb2be03f84eb48b699f0a4883
PageNumberNo> 该参数即将下线,推荐您使用NextToken与MaxResults完成分页查询操作。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:1
PageSizeNo> 该参数即将下线,推荐您使用NextToken与MaxResults完成分页查询操作。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:10
PrivateIpAddressesNoVPC网络类型实例的私有IP。当InstanceNetworkType=vpc时生效,取值可以由多个IP组成一个JSON数组,最多支持100个IP,IP之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:["172.16.1.1", "172.16.2.1", … "172.16.10.1"]
PublicIpAddressesNo实例的公网IP列表。取值可以由多个IP组成一个JSON数组,最多支持100个IP,IP之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:["42.1.1.**", "42.1.2.**", … "42.1.10.**"]
RdmaIpAddressesNoHPC实例的RDMA网络IP。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:10.10.10.102
RegionIdYes实例所属的地域ID。您可以调用[DescribeRegions](~~25609~~)查看最新的阿里云地域列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou
ResourceGroupIdNo实例所在的企业资源组ID。使用该参数过滤资源时,资源数量不能超过1000个。 >不支持默认资源组过滤。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:rg-bp67acfmxazb4p****
SecurityGroupIdNo实例所属的安全组。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:sg-bp67acfmxazb4p****
StatusNo实例状态。取值范围: - Pending:创建中。 - Running:运行中。 - Starting:启动中。 - Stopping:停止中。 - Stopped:已停止。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:Running
TagNo标签列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: array,参数示例:
VSwitchIdNo交换机ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:vsw-bp67acfmxazb4p****
VpcIdNo专有网络VPC ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:v-bp67acfmxazb4p****
ZoneIdNo可用区ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou-g

Implementation Reference

  • Configuration defining the APIs to register, including 'DescribeInstances' for the 'ecs' service.
    config = {
        'ecs': [
            'DescribeInstances',
            'DescribeRegions',
            'DescribeZones',
            'DescribeAccountAttributes',
            'DescribeAvailableResource',
            'DescribeImages',
            'DescribeSecurityGroups',
            'DeleteInstances'
        ],
        'Vpc': [
            'DescribeVpcs',
            'DescribeVSwitches'
        ],
        'rds': [
            'DescribeDBInstances'
        ]
    }
  • Registers all dynamic API tools listed in config, including DescribeInstances for ecs, by calling create_api_tools.
    api_tools.create_api_tools(mcp, config)
  • Iterates over the config to create and register each specified tool, such as DescribeInstances.
    def create_api_tools(mcp: FastMCP, config:dict):
        for service_code, apis in config.items():
            for api_name in apis:
                _create_and_decorate_tool(mcp, service_code, api_name)
  • Core execution logic for the DescribeInstances tool; handles API meta retrieval, parameter processing (special for ECS lists), client creation, and Alibaba Cloud SDK API call.
    def _tools_api_call(service: str, api: str, parameters: dict, ctx: Context):
        service = service.lower()
        api_meta, _ = ApiMetaClient.get_api_meta(service, api)
        version = ApiMetaClient.get_service_version(service)
        method = 'POST' if api_meta.get('methods', [])[0] == 'post' else 'GET'
        path = api_meta.get('path', '/')
        style = ApiMetaClient.get_service_style(service)
        
        # Handling special parameter formats
        processed_parameters = parameters.copy()
        processed_parameters = {k: v for k, v in processed_parameters.items() if v is not None}
        if service == 'ecs':
            for param_name, param_value in parameters.items():
                if param_name in ECS_LIST_PARAMETERS and isinstance(param_value, list):
                    processed_parameters[param_name] = json.dumps(param_value)
        
        req = open_api_models.OpenApiRequest(
            query=OpenApiUtilClient.query(processed_parameters)
        )
        params = open_api_models.Params(
            action=api,
            version=version,
            protocol='HTTPS',
            pathname=path,
            method=method,
            auth_type='AK',
            style=style,
            req_body_type='formData',
            body_type='json'
        )
        logger.info(f'Call API Request: Service: {service} API: {api} Method: {method} Parameters: {processed_parameters}')
        client = create_client(service, processed_parameters.get('RegionId', 'cn-hangzhou'))
        runtime = util_models.RuntimeOptions()
        resp = client.call_api(params, req, runtime)
        logger.info(f'Call API Response: {resp}')
        return resp
  • Generates the input schema and type annotations for the DescribeInstances tool based on API metadata, with special handling for ECS list parameters.
    def _create_function_schemas(service, api, api_meta):
        schemas = {}
        schemas[api] = {}
        parameters = api_meta.get('parameters', [])
    
        required_params = []
        optional_params = []
    
        for parameter in parameters:
            name = parameter.get('name')
            # TODO 目前忽略了带'.'的参数
            if '.' in name:
                continue
            schema = parameter.get('schema', '')
            required = schema.get('required', False)
    
            if required:
                required_params.append(parameter)
            else:
                optional_params.append(parameter)
    
        def process_parameter(parameter):
            name = parameter.get('name')
            schema = parameter.get('schema', '')
            description = schema.get('description', '')
            example = schema.get('example', '')
            type_ = schema.get('type', '')
            description = f'{description} 参数类型: {type_},参数示例:{example}'
            required = schema.get('required', False)
    
            if service.lower() == 'ecs' and name in ECS_LIST_PARAMETERS and type_ == 'string':
                python_type = list
            else:
                python_type = type_map.get(type_, str)
    
            field_info = (
                python_type,
                field(
                    default=None,
                    metadata={'description': description, 'required': required}
                )
            )
            return name, field_info
    
        for parameter in required_params:
            name, field_info = process_parameter(parameter)
            schemas[api][name] = field_info
    
        for parameter in optional_params:
            name, field_info = process_parameter(parameter)
            schemas[api][name] = field_info
    
        if 'RegionId' not in schemas[api]:
            schemas[api]['RegionId'] = (
                str,
                field(
                    default='cn-hangzhou',
                    metadata={'description': '地域ID', 'required': False}
                )
            )
        return schemas
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 mentions querying and retrieving details but lacks critical information: whether this is a read-only operation, if it requires specific permissions, pagination behavior (implied by parameters like MaxResults and NextToken but not explained), rate limits, or error handling. The description is too vague for a tool with 37 parameters and complex filtering capabilities.

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 front-loads the core functionality. It wastes no words and directly states what the tool does without unnecessary elaboration. Every part of the sentence contributes to understanding the tool's purpose.

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 tool's complexity (37 parameters, no output schema, no annotations), the description is inadequate. It doesn't explain the return format, pagination mechanics (critical for list queries), error conditions, or authentication requirements. The description fails to provide enough context for an agent to use this tool effectively despite the rich parameter schema.

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%, so the schema fully documents all 37 parameters with detailed descriptions, examples, and constraints. The description adds no parameter-specific information beyond the general query context. According to guidelines, baseline is 3 when schema coverage is high (>80%) and no param info is added in the description.

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 tool's purpose: '查询实例列表,并关联查询实例的详细信息' (query instance list and retrieve associated instance details). It specifies the verb (query/list) and resource (instances) with additional context about retrieving detailed information. However, it doesn't explicitly differentiate from sibling tools like 'DescribeImages' or 'DescribeRegions' which also describe resources.

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 'DescribeImages' for image queries or 'DescribeRegions' for region information, nor does it specify prerequisites or appropriate contexts for filtering instances. Usage is implied only through the general query 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