Skip to main content
Glama
aliyun

Alibaba Cloud RDS OpenAPI MCP Server

Official
by aliyun

attach_whitelist_template_to_instance

Apply a security whitelist template to an Alibaba Cloud RDS database instance to manage network access permissions.

Instructions

allocate db instance public connection.
Args:
    region_id: The region ID of the RDS instance.
    db_instance_id: The ID of the RDS instance.
    template_id: Whitelist Template ID. Can be obtained via DescribeAllWhitelistTemplate.
Returns:
    dict[str, Any]: The response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_idYes
db_instance_idYes
template_idYes

Implementation Reference

  • The core handler function implementing the attach_whitelist_template_to_instance MCP tool. It calls the Alibaba Cloud RDS AttachWhitelistTemplateToInstance API to attach a specified whitelist template to a DB instance.
    async def attach_whitelist_template_to_instance(
            region_id: str,
            db_instance_id: str,
            template_id: int
    ):
        """
        allocate db instance public connection.
        Args:
            region_id: The region ID of the RDS instance.
            db_instance_id: The ID of the RDS instance.
            template_id: Whitelist Template ID. Can be obtained via DescribeAllWhitelistTemplate.
        Returns:
            dict[str, Any]: The response.
        """
        try:
            client = get_rds_client(region_id)
            request = rds_20140815_models.AttachWhitelistTemplateToInstanceRequest(
                region_id=region_id,
                ins_name=db_instance_id,
                template_id=template_id
            )
            response = await client.attach_whitelist_template_to_instance_async(request)
            return response.body.to_map()
        except Exception as e:
            raise e
  • Helper tool to describe all whitelist templates, used to obtain template_id for attachment.
    async def describe_all_whitelist_template(
            region_id: str,
            template_name: str = None
    ) -> List[Dict[str, Any]]:
        """
        describe all whitelist template.
        Args:
            region_id: The region ID of the RDS instance.
            template_name: The ID of the RDS instance.
        Returns:
            List[Dict[str, Any]]: The response contains all whitelist template information.
        """
        try:
            client = get_rds_client(region_id)
            next_pages = True
            all_whitelists = []
            page_num = 1
            while next_pages:
                request = rds_20140815_models.DescribeAllWhitelistTemplateRequest(
                    template_name=template_name,
                    fuzzy_search=False if template_name is None else True,
                    max_records_per_page=100,
                    page_numbers=page_num
                )
                response = await client.describe_all_whitelist_template_async(request)
                next_pages = response.body.data.has_next
                page_num += 1
                all_whitelists.extend(response.body.data.templates)
            return [item.to_map() for item in all_whitelists]
        except Exception as e:
            raise e
  • Helper tool to describe the whitelist template currently linked to an instance.
    async def describe_instance_linked_whitelist_template(
            region_id: str,
            db_instance_id: str
    ):
        """
        describe instance linked whitelist template.
        Args:
            region_id: The region ID of the RDS instance.
            db_instance_id: The ID of the RDS instance.
        Returns:
            dict[str, Any]: The response.
        """
        try:
            client = get_rds_client(region_id)
            request = rds_20140815_models.DescribeInstanceLinkedWhitelistTemplateRequest(
                region_id=region_id,
                ins_name=db_instance_id
            )
            response = await client.describe_instance_linked_whitelist_template_async(request)
            return response.body.to_map()
        except Exception as e:
            raise e
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It implies a mutation ('allocate') but doesn't disclose behavioral traits such as permissions required, whether it's idempotent, rate limits, or what 'public connection' entails. The return type 'dict[str, Any]' is vague and adds little value.

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 appropriately sized and front-loaded with the purpose. The Args and Returns sections are structured, but the opening sentence is somewhat vague ('allocate db instance public connection'), and the return description is minimal, though efficient for the content provided.

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 no annotations, no output schema, and 0% schema coverage, the description is incomplete. It covers basic parameter semantics but lacks behavioral context, error handling, or detailed usage scenarios. For a mutation tool with three parameters, this leaves significant gaps for an AI agent.

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 0%, so the description must compensate. It lists all three parameters with brief explanations, adding meaning beyond the schema (e.g., 'region_id: The region ID of the RDS instance'). However, it doesn't detail formats, constraints, or relationships between parameters, leaving gaps.

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 starts with 'allocate db instance public connection,' which clearly states the action (allocate) and resource (db instance public connection). It distinguishes from siblings like 'allocate_instance_public_connection' by specifying the use of a whitelist template, though the title 'null' and vague phrasing slightly reduce clarity.

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions 'Can be obtained via DescribeAllWhitelistTemplate' for template_id, which hints at a prerequisite but doesn't specify when to choose this over tools like 'modify_security_ips' or 'allocate_instance_public_connection'.

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

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