DescribeAccountAttributes
Retrieve ECS resource quotas in a specific Alibaba Cloud region, including security groups, elastic network interfaces, vCPU cores, cloud disk capacity, dedicated hosts, network types, and account verification status.
Instructions
查询您在一个阿里云地域下能创建的ECS资源配额。包括您能创建的安全组数量、弹性网卡数量、按量付费vCPU核数、抢占式实例vCPU核数、按量付费云盘总容量配额、专用宿主机数量、网络类型以及账号是否已完成实名认证。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| AttributeName | No | 查询某类资源在指定地域下的使用配额,N的取值范围为1~8。取值范围: - instance-network-type:可选择的网络类型。 - max-security-groups:安全组数量。 - max-elastic-network-interfaces:弹性网卡的数量。 - max-postpaid-instance-vcpu-count:按量付费实例的vCPU核数上限。 - max-spot-instance-vcpu-count:抢占式实例vCPU核数上限。 - used-postpaid-instance-vcpu-count:已使用按量付费实例的vCPU核数。 - used-spot-instance-vcpu-count:已使用抢占式实例vCPU核数。 - max-postpaid-yundisk-capacity:用作数据盘的按量付费云盘的总容量上限。(该参数值已弃用) - used-postpaid-yundisk-capacity:已使用的用作数据盘的按量付费云盘容量。(该参数值已弃用) - max-dedicated-hosts:专用宿主机数量。 - supported-postpaid-instance-types:按量付费I/O优化实例规格。 - max-axt-command-count:云助手命令的数量。 - max-axt-invocation-daily:每天可以执行的云助手命令次数。 - real-name-authentication:账号是否完成了实名认证。 > 您只有完成了实名认证才可以在中国内地地域中创建ECS实例。 - max-cloud-assistant-activation-count:可创建的云助手托管实例激活码数量上限。 默认值为空。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: array,参数示例:max-security-groups | |
| RegionId | Yes | 地域ID。您可以调用[DescribeRegions](~~25609~~)查看最新的阿里云地域列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou | |
| ZoneId | No | 可用区ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou-b |
Implementation Reference
- Core execution logic for the DescribeAccountAttributes tool (and all dynamic API tools). Fetches API metadata, processes parameters (special handling for ECS list params), constructs OpenAPI request, and calls the Alibaba Cloud 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 generates the Pydantic input schema for DescribeAccountAttributes (and similar tools) by parsing API metadata, mapping types, handling ECS list parameters as lists, adding RegionId if missing.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
- src/alibaba_cloud_ops_mcp_server/tools/api_tools.py:267-271 (registration)Registers the DescribeAccountAttributes tool (along with others from config) by iterating over config['ecs'] and calling _create_and_decorate_tool to add it to the MCP server.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)
- src/alibaba_cloud_ops_mcp_server/config.py:12-12 (registration)Explicitly lists 'DescribeAccountAttributes' as one of the ECS APIs to be dynamically registered as an MCP tool.'DescribeAccountAttributes',
- src/alibaba_cloud_ops_mcp_server/server.py:88-88 (registration)Invokes the tool registration for all config-defined tools, including DescribeAccountAttributes, during MCP server initialization.api_tools.create_api_tools(mcp, config)