Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

DescribeAccountAttributes

Retrieve ECS resource quotas and account attributes in a specified Alibaba Cloud region, including security groups, vCPU limits, network types, and real-name authentication status, to manage resource allocation effectively.

Instructions

查询您在一个阿里云地域下能创建的ECS资源配额。包括您能创建的安全组数量、弹性网卡数量、按量付费vCPU核数、抢占式实例vCPU核数、按量付费云盘总容量配额、专用宿主机数量、网络类型以及账号是否已完成实名认证。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
AttributeNameNo查询某类资源在指定地域下的使用配额,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
RegionIdYes地域ID。您可以调用[DescribeRegions](~~25609~~)查看最新的阿里云地域列表。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou
ZoneIdNo可用区ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou-b

Implementation Reference

  • Generic handler function that executes the Alibaba Cloud API call for 'DescribeAccountAttributes' and similar dynamically generated tools. It fetches API metadata, prepares the request, and calls the 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 generates the input schema for the 'DescribeAccountAttributes' tool based on API metadata from Alibaba Cloud.
    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 listing 'DescribeAccountAttributes' as an available ECS tool, which triggers its dynamic registration.
    config = {
        'ecs': [
            'DescribeInstances',
            'DescribeRegions',
            'DescribeZones',
            'DescribeAccountAttributes',
            'DescribeAvailableResource',
            'DescribeImages',
            'DescribeSecurityGroups',
            'DeleteInstances'
        ],
        'Vpc': [
            'DescribeVpcs',
            'DescribeVSwitches'
        ],
        'rds': [
            'DescribeDBInstances'
        ]
    }
  • Dynamically creates and registers the tool named 'ECS_DescribeAccountAttributes' using FastMCP tool decorator.
    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
  • Invokes the creation and registration of all tools listed in config, including 'DescribeAccountAttributes' for ECS.
    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 burden. It states the query purpose but lacks behavioral details: it doesn't specify if this is a read-only operation (implied but not explicit), whether it requires authentication, rate limits, error conditions, or the format of returned data. For a quota query tool with zero annotation coverage, this is a significant gap in 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 a single, efficient sentence in Chinese that lists the quota types covered. It's front-loaded with the core purpose and avoids redundancy. However, it could be slightly more structured by separating the query action from the quota list for better readability.

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 (querying multiple quota types across regions), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the return format, error handling, or authentication needs. While it covers the purpose well, it misses critical behavioral and output context needed for effective tool 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%, so the schema already documents all three parameters (AttributeName, RegionId, ZoneId) in detail. The description adds no parameter-specific information beyond implying a regional context. Baseline 3 is appropriate as the schema does the heavy lifting, but the description doesn't enhance parameter understanding (e.g., explaining AttributeName options beyond what's in the schema).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('查询' meaning 'query') and the exact resource ('ECS资源配额' meaning 'ECS resource quotas') in a specific context ('在一个阿里云地域下' meaning 'in an Alibaba Cloud region'). It distinguishes from siblings by focusing on account-level quotas rather than instance operations (e.g., RunInstances) or resource listings (e.g., DescribeInstances).

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 prerequisites (e.g., needing RegionId), exclusions, or compare with similar tools like DescribeAvailableResource (which might show available resources rather than quotas). Usage is implied only through the query purpose.

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