Skip to content

Commit 27be09f

Browse files
author
tianzhen.wtz
committed
Merge branch yinuo/mcp_2 into master
Title: to #65849001 SDK版本号 to #65849001 SDK版本号 Link: https://code.alibaba-inc.com/idb/alibabacloud-dms-mcp-server/codereview/21531356
2 parents db483d7 + 048841a commit 27be09f

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [
88
]
99
requires-python = ">=3.12"
1010
dependencies = [
11-
"alibabacloud-dms-enterprise20181101>=1.71.0",
11+
"alibabacloud-dms-enterprise20181101>=1.72.0",
1212
"alibabacloud-tea-openapi==0.4.0rc3",
1313
"httpx>=0.28.1",
1414
"mcp[cli]>=1.6.0",

src/alibabacloud_dms_mcp_server/server.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,26 @@ def create_client() -> dms_enterprise20181101Client:
2828

2929
@mcp.tool(name="addInstance",
3030
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.
3244
""")
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]:
3551
if not db_user or not isinstance(db_user, str):
3652
logging.error("Invalid db_user parameter: %s", db_user)
3753
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
6985
description="""
7086
Retrieve detailed instance information from DMS.
7187
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.
7490
sid (Optional[str]): Required for Oracle like databases. Defaults to None.
7591
Returns:
7692
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
7995
- InstanceType: Database Engine type
8096
- InstanceAlias: Instance alias in DMS
8197
""")
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]:
83101
"""
84102
Retrieve detailed instance information from DMS.
85103
Parameters:
@@ -344,7 +362,7 @@ async def getMetaTableDetailInfo(table_guid: str) -> Dict[str, Any]:
344362
description="""
345363
Execute SQL script against a database in DMS and return structured results.
346364
Parameters:
347-
database_id (int): Required DMS databaseId. Obtained via getDatabase tool.
365+
database_id (str): Required DMS databaseId. Obtained via getDatabase tool.
348366
script (str): SQL script to execute.
349367
Returns:
350368
Dict[str, Any] containing:

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)