@@ -28,10 +28,26 @@ def create_client() -> dms_enterprise20181101Client:
28
28
29
29
@mcp .tool (name = "addInstance" ,
30
30
description = """
31
-
31
+ Add an instance to DMS. If the instance already exists, it will return the existing instance information.
32
+ Parameters:
33
+ db_user (str): The username used to connect to the database.
34
+ db_password (str): The password used to connect to the database.
35
+ instance_resource_id (str, optional): The resource id of the instance, typically assigned by the cloud provider.
36
+ host (str, optional): The hostname of the database instance.
37
+ port (str, optional): The connection port number.
38
+ region (str, optional): The region where the instance is located (e.g., "cn-hangzhou").
39
+ Returns:
40
+ Dict[str, Any]: A dictionary containing instance details with these keys:
41
+ - instance_id: Unique instance identifier in DMS.
42
+ - host: The hostname of the database instance.
43
+ - port: The connection port number.
32
44
""" )
33
- async def addInstance (db_user : str , db_password : str , instance_resource_id : Optional [str ] = None ,
34
- host : Optional [str ] = None , port : Optional [str ] = None , region : Optional [str ] = None ) -> Dict [str , Any ]:
45
+ async def addInstance (db_user : str ,
46
+ db_password : str ,
47
+ instance_resource_id : Optional [str ] = None ,
48
+ host : Optional [str ] = None ,
49
+ port : Optional [str ] = None ,
50
+ region : Optional [str ] = None ) -> Dict [str , Any ]:
35
51
if not db_user or not isinstance (db_user , str ):
36
52
logging .error ("Invalid db_user parameter: %s" , db_user )
37
53
return "db_user must be a non-empty string"
@@ -69,8 +85,8 @@ async def addInstance(db_user: str, db_password: str, instance_resource_id: Opti
69
85
description = """
70
86
Retrieve detailed instance information from DMS.
71
87
Parameters:
72
- host (str): The hostname or IP address of the database instance
73
- port (int ): Connection port number (valid range: 1-65535)
88
+ host (str): The hostname of the database instance.
89
+ port (str ): The connection port number.
74
90
sid (Optional[str]): Required for Oracle like databases. Defaults to None.
75
91
Returns:
76
92
Dict[str, Any]: A dictionary containing instance details with these keys:
@@ -79,7 +95,9 @@ async def addInstance(db_user: str, db_password: str, instance_resource_id: Opti
79
95
- InstanceType: Database Engine type
80
96
- InstanceAlias: Instance alias in DMS
81
97
""" )
82
- async def getInstance (host : str , port : str , sid : Optional [str ] = None ) -> Dict [str , Any ]:
98
+ async def getInstance (host : str ,
99
+ port : str ,
100
+ sid : Optional [str ] = None ) -> Dict [str , Any ]:
83
101
"""
84
102
Retrieve detailed instance information from DMS.
85
103
Parameters:
@@ -344,7 +362,7 @@ async def getMetaTableDetailInfo(table_guid: str) -> Dict[str, Any]:
344
362
description = """
345
363
Execute SQL script against a database in DMS and return structured results.
346
364
Parameters:
347
- database_id (int ): Required DMS databaseId. Obtained via getDatabase tool.
365
+ database_id (str ): Required DMS databaseId. Obtained via getDatabase tool.
348
366
script (str): SQL script to execute.
349
367
Returns:
350
368
Dict[str, Any] containing:
0 commit comments