Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

listInstances

Read-only

List database instances from Alibaba Cloud DMS using filters such as host, database type, or environment type.

Instructions

Search for instances from DMS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_keyNoOptional search key (e.g., instance host, instance alias, etc.)
db_typeNoOptional instanceType, or called dbType (e.g., mysql, polardb, oracle, postgresql, sqlserver, polardb-pg, etc.)
env_typeNoOptional instance environment type (e.g., product, dev, test, etc. )

Implementation Reference

  • The 'list_instance' async function is the actual handler for the 'listInstances' tool. It accepts optional search_key, db_type, and env_type parameters, calls the Alibaba Cloud DMS API client.list_instances(), processes the response into InstanceDetail objects, and returns them.
    async def list_instance(
            search_key: Optional[str] = Field(default=None,
                                              description="Optional search key (e.g., instance host, instance alias, etc.)"),
            db_type: Optional[str] = Field(default=None,
                                           description="Optional instanceType, or called dbType (e.g., mysql, polardb, oracle, "
                                                       "postgresql, sqlserver, polardb-pg, etc.)"),
            env_type: Optional[str] = Field(default=None,
                                            description="Optional instance environment type (e.g., product, dev, test, etc. )")
    ) -> List[InstanceDetail]:
        client = create_client()
        req = dms_enterprise_20181101_models.ListInstancesRequest()
        if search_key:
            req.search_key = search_key
        if db_type:
            req.db_type = db_type
        if env_type:
            req.env_type = env_type
        if mcp.state.real_login_uid:
            req.real_login_user_uid = mcp.state.real_login_uid
        try:
            resp = client.list_instances(req)
    
            instance_data = resp.body.to_map()
            if "InstanceList" not in instance_data:
                return []
            instance_list = instance_data["InstanceList"]
            # 检查是否有 Instance 键
            if "Instance" not in instance_list:
                return []
            instances = instance_list["Instance"]
            # 检查是否为空
            if not isinstance(instances, list) or not instances:
                return []
    
            processed_instances = [
                {**item, 'InstanceResourceId': item.pop('EcsInstanceId', None)}
                for item in instances
            ]
            return [InstanceDetail(**item) for item in processed_instances]
        except Exception as e:
            logger.error(f"Error in list_instance: {e}")
            raise
  • The 'InstanceDetail' Pydantic model defines the schema for the output of listInstances. It includes fields such as InstanceId, State, InstanceType, InstanceAlias, EnvType, Host, Port, InstanceSource, and InstanceResourceId.
    class InstanceDetail(MyBaseModel):
        InstanceId: Any = Field(description="Unique instance identifier in DMS", default=None)
        State: Any = Field(description="Current operational status", default=None)
        InstanceType: Any = Field(description="Database Engine type", default=None)
        InstanceAlias: Any = Field(description="Instance alias in DMS", default=None)
        EnvType: Any = Field(description="The environment type of the instance (e.g., production, development, etc.)",
                             default=None)
        Host: Any = Field(description="The hostname of the database instance", default=None)
        Port: Any = Field(description="The connection port number", default=None)
        InstanceSource: Any = Field(description="The instance source (e.g., RDS, VPC_IDC, ECS_OWN, PUBLIC_OWN etc.)",
                                    default=None)
        InstanceResourceId: Any = Field(
            description="Resource ID of the instance from RDS",
            default=None)
  • The 'listInstances' tool is registered in '_register_full_toolset()' via self.mcp.tool(name='listInstances', ...) which binds the 'list_instance' handler function as the tool's implementation.
    self.mcp.tool(name="listInstances", description="Search for instances from DMS.",
                  annotations={"title": "搜索DMS实例列表", "readOnlyHint": True})(list_instance)
Behavior2/5

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

The readOnlyHint annotation already indicates idempotent read behavior. The description adds no further behavioral details, such as pagination, result limits, or filtering behavior.

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?

Single sentence, no wasted words. Front-loaded with purpose. Could benefit from slightly more detail without harming conciseness.

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?

For a search tool with three optional parameters and no output schema, the description is too sparse. It does not clarify what the output is (e.g., list of instance objects), nor any ordering or default behavior.

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 explains each parameter. The description adds no extra meaning beyond what the schema provides, but it does not degrade it either.

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 clearly states the action ('Search') and the resource ('instances from DMS'). It distinguishes from siblings like getInstance (specific instance) and searchDatabase (different resource), though it could be more precise about what constitutes an instance.

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 guidance on when to use this tool versus alternatives (e.g., getInstance, searchDatabase). The description does not mention use cases, preconditions, or exclusions.

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-dms-mcp-server'

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