Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

DescribeAvailableResource

Check resource availability in AlibabaCloud MCP Server zones for creating or modifying instances. Identifies inventory status of resources like instance types, networks, and disks to ensure seamless deployment.

Instructions

查询可用区的资源库存状态。您可以在某一可用区创建实例(RunInstances)或者修改实例规格(ModifyInstanceSpec)时查询该可用区的资源库存状态。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
CoresNo实例规格的vCPU内核数目。取值参见[实例规格族](~~25378~~)。 当DestinationResource取值为InstanceType时,Cores才为有效参数。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:2
DataDiskCategoryNo数据盘类型。取值范围: - cloud:普通云盘。 - cloud_efficiency:高效云盘。 - cloud_ssd:SSD云盘。 - ephemeral_ssd:本地SSD盘。 - cloud_essd:ESSD云盘。 - cloud_auto:ESSD AutoPL云盘。 <props="china"> - cloud_essd_entry:ESSD Entry云盘。 </props> 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cloud_ssd
DedicatedHostIdNo专有宿主机ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:dh-bp165p6xk2tlw61e****
DestinationResourceYes要查询的资源类型。取值范围: - Zone:可用区。 - IoOptimized:I/O优化。 - InstanceType:实例规格。 - Network:网络类型。 - ddh:专有宿主机。 - SystemDisk:系统盘。 - DataDisk:数据盘。 >当DestinationResource取值为`SystemDisk`时,由于系统盘受实例规格限制,此时必须传入InstanceType。 参数DestinationResource的取值方式请参见本文中的**接口说明**。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:InstanceType
InstanceChargeTypeNo资源的计费方式。更多信息,请参见[计费概述](~~25398~~)。取值范围: - PrePaid:包年包月。 - PostPaid:按量付费。 默认值:PostPaid。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:PrePaid
InstanceTypeNo实例规格。更多信息,请参见[实例规格族](~~25378~~),您也可以调用[DescribeInstanceTypes](~~25620~~)接口获得最新的规格表。 参数InstanceType的取值方式请参见本文开头的**接口说明**。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:ecs.g5.large
IoOptimizedNo是否为I/O优化实例。取值范围: - none:非I/O优化实例。 - optimized:I/O优化实例。 默认值:optimized。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:optimized
MemoryNo实例规格的内存大小,单位为GiB。取值参见[实例规格族](~~25378~~)。 当DestinationResource取值为InstanceType时,Memory才为有效参数。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: number,参数示例:8.0
NetworkCategoryNo网络类型。取值范围: - vpc:专有网络。 - classic:经典网络。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:vpc
RegionIdYes目标地域ID。您可以调用[DescribeRegions](~~25609~~)查看最新的阿里云地域列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou
ResourceTypeNo资源类型。取值范围: - instance:ECS实例。 - disk:云盘。 - reservedinstance:预留实例券。 - ddh:专有宿主机。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:instance
ScopeNo预留实例券的范围。取值范围: - Region:地域级别。 - Zone:可用区级别。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:Region
SpotDurationNo抢占式实例的保留时长,单位为小时。 默认值:1。取值范围: - 1:创建后阿里云会保证实例运行1小时不会被自动释放;超过1小时后,系统会自动比较出价与市场价格、检查资源库存,来决定实例的持有和回收。 - 0:创建后,阿里云不保证实例运行1小时,系统会自动比较出价与市场价格、检查资源库存,来决定实例的持有和回收。 实例回收前5分钟阿里云会通过ECS系统事件向您发送通知。抢占式实例按秒计费,建议您结合具体任务执行耗时来选择合适的保留时长。 > 当`InstanceChargeType`取值为`PostPaid`,并且`SpotStrategy`值为`SpotWithPriceLimit`或`SpotAsPriceGo`时该参数生效。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:1
SpotStrategyNo按量付费实例的竞价策略。取值范围: - NoSpot:正常按量付费实例。 - SpotWithPriceLimit:设置上限价格的抢占式实例。 - SpotAsPriceGo:系统自动出价,最高按量付费价格。 默认值:NoSpot。 当参数`InstanceChargeType`取值为`PostPaid`时,参数`SpotStrategy`才有效。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:NoSpot
SystemDiskCategoryNo系统盘类型。取值范围: - cloud:普通云盘。 - cloud_efficiency:高效云盘。 - cloud_ssd:SSD云盘。 - ephemeral_ssd:本地SSD盘。 - cloud_essd:ESSD云盘。 - cloud_auto:ESSD AutoPL云盘。 <props="china"> - cloud_essd_entry:ESSD Entry云盘。 </props> 默认值:cloud_efficiency。 > 参数ResourceType取值为instance、DestinationResource取值为DataDisk时,参数SystemDiskCategory是必选参数。如果未传递参数值,则以默认值生效。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cloud_ssd
ZoneIdNo可用区ID。 默认值:无。返回该地域(`RegionId`)下所有可用区符合查询条件的资源。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou-e

Implementation Reference

  • Configuration listing 'DescribeAvailableResource' as one of the ECS tools to be dynamically registered.
    'ecs': [
        'DescribeInstances',
        'DescribeRegions',
        'DescribeZones',
        'DescribeAccountAttributes',
        'DescribeAvailableResource',
        'DescribeImages',
        'DescribeSecurityGroups',
        'DeleteInstances'
    ],
  • Calls create_api_tools to register all API tools from config, including DescribeAvailableResource.
    api_tools.create_api_tools(mcp, config)
  • Iterates over config to create and register dynamic tools like ECS_DescribeAvailableResource.
    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)
  • Handler function that executes the Alibaba Cloud API call for dynamic tools including DescribeAvailableResource.
    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
  • Dynamically creates the input schema for the DescribeAvailableResource tool from API metadata.
    def _create_parameter_schema(fields: dict):
        return make_dataclass("ParameterSchema", [(name, type_, value) for name, (type_, value) in fields.items()])
    
    
    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. While it indicates this is a query/read operation (implied by '查询'), it doesn't address important behavioral aspects like: whether this requires specific permissions, rate limits, pagination behavior, error conditions, or what the response format looks like. For a complex 16-parameter tool with no annotation coverage, this is a significant gap in behavioral transparency.

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

Conciseness4/5

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

The description is appropriately concise - just two sentences that directly state the purpose and usage context. It's front-loaded with the core purpose and wastes no words. However, it could be slightly more structured by separating the purpose from usage guidance more clearly.

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 (16 parameters, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what 'resource inventory status' means in practical terms, what the output looks like, how to interpret results, or any limitations/constraints of the query. For a tool that presumably returns availability/capacity information critical for provisioning decisions, more context about the nature and format of results would be essential.

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 already documents all 16 parameters thoroughly with descriptions, examples, and constraints. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it doesn't explain parameter relationships, provide usage examples, or clarify complex dependencies. With complete schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't need to given the comprehensive schema.

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 resource inventory status in availability zones). It specifies the verb ('查询' - query) and resource ('资源库存状态' - resource inventory status), and mentions two specific use cases (creating instances or modifying instance specs). However, it doesn't explicitly differentiate from sibling tools like DescribeZones or DescribeRegions that might provide related but different information.

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

Usage Guidelines4/5

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

The description provides good context about when to use this tool: '您可以在某一可用区创建实例(RunInstances)或者修改实例规格(ModifyInstanceSpec)时查询该可用区的资源库存状态' (You can query resource inventory status when creating instances or modifying instance specs in an availability zone). This gives clear situational guidance. However, it doesn't explicitly state when NOT to use it or mention alternative tools for similar purposes.

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/alibaba-cloud-ops-mcp-server'

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