Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

DescribeRegions

Retrieve region information lists for Alibaba Cloud resources based on billing methods, resource types, and other parameters to optimize resource allocation and deployment.

Instructions

根据计费方式、资源类型等参数查询地域信息列表。

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:包年包月。此时,请确认自己的账号支持余额支付或者信用支付,否则将报错InvalidPayMethod。 - PostPaid:按量付费。 - SpotWithPriceLimit:设置上限价格。 - SpotAsPriceGo:系统自动出价,最高按量付费价格。 默认值:PostPaid。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:PrePaid
RegionIdNo地域ID
ResourceTypeNo资源类型。取值范围: - instance:ECS实例。 - disk:磁盘。 - reservedinstance:预留实例券。 - scu:存储容量单位包。 默认值:instance。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:instance

Implementation Reference

  • This function registers dynamic MCP tools for each API listed in the config, including the 'DescribeRegions' tool for the 'ecs' service by calling _create_and_decorate_tool.
    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 handler logic executed by the dynamic DescribeRegions tool. Fetches API metadata for 'ecs.DescribeRegions', prepares the request, and calls the Alibaba Cloud OpenAPI client.
    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 DescribeRegions tool by parsing the API metadata parameters for 'ecs.DescribeRegions'.
    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
  • Configuration dictionary that specifies 'DescribeRegions' as one of the APIs to register for the 'ecs' service.
    config = {
        'ecs': [
            'DescribeInstances',
            'DescribeRegions',
            'DescribeZones',
            'DescribeAccountAttributes',
            'DescribeAvailableResource',
            'DescribeImages',
            'DescribeSecurityGroups',
            'DeleteInstances'
        ],
        'Vpc': [
            'DescribeVpcs',
            'DescribeVSwitches'
        ],
        'rds': [
            'DescribeDBInstances'
        ]
    }
  • Invocation of create_api_tools with config, which triggers registration of the DescribeRegions tool.
    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 full responsibility for behavioral disclosure. It only states the query function without mentioning whether this is a read-only operation, if it requires authentication, what the response format looks like, or any rate limits. For a query tool with zero annotation coverage, this leaves significant behavioral aspects undocumented.

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 a single, efficient sentence that directly states the tool's function. It's appropriately sized for a query tool and front-loads the core purpose without unnecessary elaboration. Every word contributes to understanding what the tool does.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the query returns (e.g., region names, IDs, availability statuses), how results are structured, or any behavioral constraints. For a tool that presumably returns important infrastructure metadata, this leaves too much unspecified for effective agent use.

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%, meaning all four parameters are thoroughly documented in the input schema with descriptions, examples, and allowed values. The description mentions '计费方式' (billing method) and '资源类型' (resource type) which correspond to InstanceChargeType and ResourceType parameters, but adds no additional semantic context beyond what the schema already provides. The baseline score of 3 is appropriate when the schema does the heavy lifting.

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 as querying a list of region information based on billing methods and resource types. It uses specific verbs ('查询' - query) and resources ('地域信息列表' - region information list), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like DescribeZones or DescribeAvailableResource, which appear to serve similar informational purposes.

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 DescribeZones (which might provide zone-level information) or DescribeAvailableResource (which might focus on resource availability rather than region metadata). There's no context about prerequisites, typical use cases, or exclusions.

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