Skip to main content
Glama
aliyun

Alibaba Cloud RDS OpenAPI MCP Server

Official
by aliyun

describe_vpcs

Query and list Virtual Private Clouds (VPCs) in Alibaba Cloud by region, ID, name, tags, or other filters to manage network configurations for RDS instances.

Instructions

Query VPC list.

Args: region_id: The region ID of the VPC. vpc_id: The ID of the VPC. Up to 20 VPC IDs can be specified, separated by commas. vpc_name: The name of the VPC. resource_group_id: The resource group ID of the VPC to query. page_number: The page number of the list. Default: 1. page_size: The number of entries per page. Maximum value: 50. Default: 10. vpc_owner_id: The Alibaba Cloud account ID of the VPC owner. tags: The tags of the resource. Returns: Dict[str, Any]: The response containing the list of VPCs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_idYes
vpc_idNo
vpc_nameNo
resource_group_idNo
page_numberNo
page_sizeNo
vpc_owner_idNo
tagsNo

Implementation Reference

  • The handler function that implements the 'describe_vpcs' MCP tool. It uses the Alibaba Cloud VPC SDK to query VPCs based on provided filters and returns the results.
    @mcp.tool(annotations=READ_ONLY_TOOL) async def describe_vpcs( region_id: str, vpc_id: str = None, vpc_name: str = None, resource_group_id: str = None, page_number: int = 1, page_size: int = 10, vpc_owner_id: int = None, tags: List[Dict[str, str]] = None ) -> Dict[str, Any]: """Query VPC list. Args: region_id: The region ID of the VPC. vpc_id: The ID of the VPC. Up to 20 VPC IDs can be specified, separated by commas. vpc_name: The name of the VPC. resource_group_id: The resource group ID of the VPC to query. page_number: The page number of the list. Default: 1. page_size: The number of entries per page. Maximum value: 50. Default: 10. vpc_owner_id: The Alibaba Cloud account ID of the VPC owner. tags: The tags of the resource. Returns: Dict[str, Any]: The response containing the list of VPCs. """ try: # Initialize the client client = get_vpc_client(region_id) # Create request request = vpc_20160428_models.DescribeVpcsRequest( region_id=region_id, page_number=page_number, page_size=page_size ) # Add optional parameters if provided if vpc_id: request.vpc_id = vpc_id if vpc_name: request.vpc_name = vpc_name if resource_group_id: request.resource_group_id = resource_group_id if vpc_owner_id: request.vpc_owner_id = vpc_owner_id if tags: request.tag = tags # Make the API request response = client.describe_vpcs(request) return response.to_map() except Exception as e: logger.error(f"Error occurred while querying VPCs: {str(e)}") raise OpenAPIError(f"Failed to query VPCs: {str(e)}")
  • Helper function to create and return a configured VpcClient instance used by the describe_vpcs tool.
    def get_vpc_client(region_id: str) -> VpcClient: """Get VPC client instance. Args: region_id: The region ID for the VPC client. Returns: VpcClient: The VPC client instance for the specified region. """ ak, sk, sts = get_aksk() config = Config( access_key_id=ak, access_key_secret=sk, security_token=sts, region_id=region_id, protocol="https", connect_timeout=10 * 1000, read_timeout=300 * 1000 ) return VpcClient(config)
  • The @mcp.tool decorator registers the describe_vpcs function as an MCP tool with read-only annotation.
    @mcp.tool(annotations=READ_ONLY_TOOL)

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-rds-openapi-mcp-server'

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