Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

DescribeZones

Query available zone details on AlibabaCloud by specifying region ID, billing method, and other parameters. Retrieve comprehensive zone information to manage and deploy resources efficiently.

Instructions

根据地域ID、计费方式等参数查询可用区信息列表。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
AcceptLanguageNo根据汉语、英语和日语筛选返回结果。更多信息,请参见[RFC 7231](https://tools.ietf.org/html/rfc7231)。取值范围: - zh-CN:简体中文。 - zh-TW:繁体中文。 - en-US:英文。 - ja:日文。 - fr:法语。 - de:德语。 - ko:韩语。 默认值:zh-CN。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:zh-CN
InstanceChargeTypeNo可用区里支持的资源计费方式。更多信息,请参见[计费概述](~~25398~~)。取值范围: - PrePaid:包年包月。 - PostPaid:按量付费。 默认值:PostPaid。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:PostPaid
RegionIdYes可用区所在的地域ID。您可以调用[DescribeRegions](~~25609~~)查看最新的阿里云地域列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou
SpotStrategyNo按量付费实例的竞价策略。当`InstanceChargeType=PostPaid`时,您可以传入该参数。更多信息,请参见[抢占式实例](~~52088~~)。取值范围: - NoSpot:正常按量付费实例。 - SpotWithPriceLimit:设置上限价格的抢占式实例。 - SpotAsPriceGo:系统自动出价,最高按量付费价格。 默认值:NoSpot。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:NoSpot
VerboseNo是否展示详细信息。 - true:展示。 - false:不展示。 默认值:true。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false

Implementation Reference

  • The _tools_api_call function implements the core logic for calling Alibaba Cloud APIs, used by the dynamic DescribeZones tool.
    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
  • _create_function_schemas dynamically generates the input schema for tools like DescribeZones based on API meta data.
    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
  • _create_and_decorate_tool creates and registers the dynamic tool function for each API including DescribeZones using mcp.tool()
    def _create_and_decorate_tool(mcp: FastMCP, service: str, api: str):
        """Create a tool function for an AlibabaCloud openapi."""
        api_meta, _ = ApiMetaClient.get_api_meta(service, api)
        fields = _create_function_schemas(service, api, api_meta).get(api, {})
        description = api_meta.get('summary', '')
        dynamic_lambda = _create_tool_function_with_signature(service, api, fields, description)
        function_name = f'{service.upper()}_{api}'
        decorated_function = mcp.tool(name=function_name)(dynamic_lambda)
    
        return decorated_function
  • Config lists 'DescribeZones' under 'ecs' service, which triggers its dynamic tool registration.
    'ecs': [
        'DescribeInstances',
        'DescribeRegions',
        'DescribeZones',
        'DescribeAccountAttributes',
        'DescribeAvailableResource',
        'DescribeImages',
        'DescribeSecurityGroups',
        'DeleteInstances'
    ],
  • api_tools.create_api_tools(mcp, config) is called to register all tools listed in config, including DescribeZones.
    api_tools.create_api_tools(mcp, config)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool queries information, implying it's a read-only operation, but doesn't confirm this or describe other traits like rate limits, authentication needs, error conditions, or pagination. For a tool with 5 parameters and no annotations, this minimal description leaves critical behavioral aspects unspecified.

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 purpose and key parameters. It's front-loaded with no wasted words, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's function.

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 (5 parameters, no output schema, no annotations), the description is insufficiently complete. It lacks information on the return format (e.g., what fields are included in the list), error handling, or typical use cases. For a query tool with multiple parameters and no structured output documentation, users need more context to use it effectively.

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?

The schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly with descriptions, examples, and defaults. The description adds minimal value by listing '地域ID、计费方式等参数' (region ID, billing method, and other parameters), which loosely maps to RegionId and InstanceChargeType, but doesn't provide additional context or meaning beyond what's in the schema. This meets the baseline for high schema 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 tool's purpose: '查询可用区信息列表' (query availability zone information list) with filtering by '地域ID、计费方式等参数' (region ID, billing method, and other parameters). It specifies both the action (query/list) and resource (availability zones), but doesn't explicitly differentiate from sibling tools like DescribeRegions or DescribeAvailableResource, which appear related.

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?

No guidance is provided on when to use this tool versus alternatives. The description mentions parameters but doesn't explain the context or prerequisites for use, such as whether it's for resource provisioning or general information lookup. With many sibling tools in the server (e.g., DescribeRegions, DescribeAvailableResource), the lack of comparative guidance is a significant gap.

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