Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

addInstance

Add Alibaba Cloud database instances to DMS for cross-engine data querying using credentials and connection details.

Instructions

Add an instance to DMS. The username and password are required. Only Aliyun instances are supported. Either instance_resource_id or host and port must be provided. The region is optional, but it's recommended to include it.If the instance already exists, it will return the existing instance information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_userYesThe username used to connect to the database
db_passwordYesThe password used to connect to the database
instance_resource_idNoAliyun instance resource ID
hostNoThe hostname of the database instance
portNoThe connection port number
regionNoThe region (e.g., 'cn-hangzhou')

Implementation Reference

  • The main handler function for the 'addInstance' tool. It validates inputs, creates a DMS client, constructs a SimplyAddInstanceRequest, calls the Alibaba Cloud API, parses the response into an InstanceInfo model, and handles errors.
    async def add_instance(
            db_user: str = Field(description="The username used to connect to the database"),
            db_password: str = Field(description="The password used to connect to the database"),
            instance_resource_id: Optional[str] = Field(default=None, description="Aliyun instance resource ID"),
            host: Optional[str] = Field(default=None, description="The hostname of the database instance"),
            port: Optional[str] = Field(default=None, description="The connection port number"),
            region: Optional[str] = Field(default=None, description="The region (e.g., 'cn-hangzhou')")
    ) -> InstanceInfo:
        if not db_user or not isinstance(db_user, str):
            raise ValueError("db_user must be a non-empty string")
        if not db_password or not isinstance(db_password, str):
            raise ValueError("db_password must be a non-empty string")
        client = create_client()
        req = dms_enterprise_20181101_models.SimplyAddInstanceRequest(database_user=db_user, database_password=db_password)
        if host:
            req.host = host
        if port:
            req.port = port
        if instance_resource_id:
            req.instance_id = instance_resource_id
        if region:
            req.region = region
        if mcp.state.real_login_uid:
            req.real_login_user_uid = mcp.state.real_login_uid
        try:
            resp = client.simply_add_instance(req)
    
            if resp and resp.body:
                body_dict = resp.body.to_map()
                return InstanceInfo(**(body_dict['Instance'] if 'Instance' in body_dict else body_dict))
            else:
                return InstanceInfo()
    
        except Exception as e:
            logger.error(f"Error in add_instance: {e}")
            raise
  • The registration of the 'addInstance' tool in the FastMCP server within the _register_full_toolset method, specifying name, description, annotations, and linking to the add_instance handler function.
    self.mcp.tool(name="addInstance",
                  description="Add an instance to DMS. The username and password are required. "
                              "Only Aliyun instances are supported. "
                              "Either instance_resource_id or host and port must be provided. "
                              "The region is optional, but it's recommended to include it."
                              "If the instance already exists, it will return the existing instance information.",
                  annotations={"title": "添加或获取DMS实例", "readOnlyHint": False, "destructiveHint": False})(
        add_instance)
  • Pydantic model defining the output schema for the addInstance tool, used to structure the response containing key instance details like ID, host, and port.
    class InstanceInfo(MyBaseModel):
        InstanceId: Any = Field(description="Unique instance identifier in DMS", default=None)
        Host: Any = Field(description="The hostname of the database instance", default=None)
        Port: Any = Field(description="The connection port number", default=None)
Behavior3/5

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

Annotations indicate this is not read-only and not destructive, but the description adds valuable behavioral context: it specifies that only Aliyun instances are supported, describes the idempotent behavior (returns existing instance if already added), and mentions optional parameters with recommendations. This goes beyond annotations, though it could include more details like error handling or authentication requirements.

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 concise, with four sentences that each add value: stating the purpose, listing required parameters, specifying constraints, and describing idempotent behavior. It's front-loaded with the main action, though it could be slightly more structured (e.g., bullet points for conditions).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, mutation operation) and lack of output schema, the description is moderately complete. It covers key behavioral aspects like idempotency and constraints, but could benefit from more detail on error cases, return values, or integration with sibling tools. With annotations covering safety, it's adequate but has gaps.

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 parameters thoroughly. The description adds some semantic context by explaining the conditional logic ('Either instance_resource_id or host and port must be provided') and recommending the region parameter, but doesn't provide significant additional meaning beyond what the schema descriptions offer. This meets the baseline for high schema coverage.

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 ('Add an instance to DMS') and specifies the resource ('instance'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'getInstance' or 'listInstances' beyond the 'add' verb, which is why it doesn't reach a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some context by stating 'Only Aliyun instances are supported' and 'If the instance already exists, it will return the existing instance information,' which implies usage scenarios. However, it lacks explicit guidance on when to use this tool versus alternatives like 'getInstance' or 'listInstances,' and doesn't mention prerequisites or exclusions beyond the Aliyun limitation.

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