Skip to main content
Glama
aliyun

Alibaba Cloud MCP Server

Official
by aliyun

DescribeVpcs

Query and retrieve details of created VPCs within Alibaba Cloud, filtering by ID, name, region, default status, or resource group for efficient network resource management.

Instructions

查询已创建的VPC。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
DhcpOptionsSetIdNoDHCP选项集的ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:dopt-o6w0df4epg9zo8isy****
DryRunNo是否只预检此次请求,取值: - **true**:发送检查请求,不会查询资源状况。检查项包括AccessKey是否有效、RAM用户的授权情况和是否填写了必需参数。如果检查不通过,则返回对应错误。如果检查通过,会返回错误码`DryRunOperation`。 - **false**(默认值):发送正常请求,通过检查后返回HTTP 2xx状态码并直接查询资源状况。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
EnableIpv6No是否查询指定地域下开启IPv6网段的VPC,默认为空值(空值则不根据是否开启IPv6网段做过滤),取值: - **false**:不开启。 - **true**:开启。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
IsDefaultNo是否查询指定地域下的默认VPC,取值: - **true**(默认值):查询指定地域下的默认VPC。 - **false**:不查询默认VPC。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: boolean,参数示例:false
PageNumberNo 列表的页码,默认值为**1**。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:1
PageSizeNo分页查询时每页的行数,最大值为**50**,默认值为**10**。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:10
RegionIdYesVPC所在的地域ID。 您可以通过调用[DescribeRegions](~~448570~~)接口获取地域ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:cn-hangzhou
ResourceGroupIdNo要查询的VPC所属的资源组ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:rg-acfmxvfvazb4p****
TagNo资源的标签。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: array,参数示例:
VpcIdNoVPC的ID。 最多支持指定20个VPC ID,多个VPC的ID之间用半角逗号(,)隔开。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:vpc-bp1b1xjllp3ve5yze****
VpcNameNoVPC的名称。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: string,参数示例:Vpc-1
VpcOwnerIdNoVPC所属的阿里云账号ID。 请注意,提供参数要严格按照参数的类型和参数示例的提示,如果提到参数为String,且为一个 JSON 数组字符串,应在数组内使用单引号包裹对应的参数以避免转义问题,并在最外侧用双引号包裹以确保其是字符串,否则可能会导致参数解析错误。参数类型: integer,参数示例:253460731706911258

Implementation Reference

  • Core handler function that executes the Alibaba Cloud API call for the DescribeVpcs tool and all similar dynamic API tools.
    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 and type definitions for the DescribeVpcs tool based on Alibaba Cloud API metadata.
    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
  • Registers the DescribeVpcs tool (and others) by dynamically creating tool functions and applying the MCP tool decorator.
    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)
  • Configuration defining DescribeVpcs as one of the VPC service tools to be registered.
    'Vpc': [ 'DescribeVpcs', 'DescribeVSwitches' ],
  • Invokes tool registration for all configured API tools including DescribeVpcs.
    api_tools.create_api_tools(mcp, config)

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/alibabacloud-ecs-mcp-server'

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