Skip to content

Commit eb0e529

Browse files
author
依诺
committed
Update instance information
1 parent d2e23a4 commit eb0e529

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

doc/Tool-List-cn.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@
6363
- **question** (字符串, 必需): 需要转换为 SQL 的自然语言问题。
6464
- **database_id** (整数, 必需): DMS 数据库 ID,可通过 getDatabase 工具获取。
6565
- **knowledge** (字符串, 可选): 用于辅助 SQL 生成的额外上下文或数据库知识。
66+
- **model** (字符串, 可选): 指定的大模型类型,目前可使用通义千问系列的模型。
67+
6668

6769
#### askDatabase: 通过自然语言问题直接获取数据库执行结果
6870
- **question** (字符串, 必需): 需要转换为 SQL 的自然语言问题。
6971
- **knowledge** (字符串, 可选): 用于辅助 SQL 生成的额外上下文或数据库知识。
72+
- **model** (字符串, 可选): 指定的大模型类型,目前可使用通义千问系列的模型。
73+
7074
---
7175
### 数据迁移相关
7276

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "alibabacloud-dms-mcp-server"
3-
version = "0.1.14"
3+
version = "0.1.15"
44
description = "MCP Server for AlibabaCloud DMS"
55
readme = "README.md"
66
authors = [

src/alibabacloud_dms_mcp_server/server.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class InstanceDetail(MyBaseModel):
4343
Port: Any = Field(description="The connection port number", default=None)
4444
InstanceSource: Any = Field(description="The instance source (e.g., RDS, VPC_IDC, ECS_OWN, PUBLIC_OWN etc.)",
4545
default=None)
46+
InstanceResourceId: Any = Field(
47+
description="Resource ID of the instance from RDS",
48+
default=None)
4649

4750

4851
class DatabaseInfo(MyBaseModel):
@@ -179,6 +182,8 @@ async def get_instance(
179182
try:
180183
resp = client.get_instance(req)
181184
instance_data = resp.body.to_map().get('Instance', {}) if resp and resp.body else {}
185+
instance_data['InstanceResourceId'] = instance_data.pop('EcsInstanceId', None)
186+
182187
return InstanceDetail(**instance_data)
183188
except Exception as e:
184189
logger.error(f"Error in get_instance: {e}")
@@ -218,7 +223,12 @@ async def list_instance(
218223
# 检查是否为空
219224
if not isinstance(instances, list) or not instances:
220225
return []
221-
return [InstanceDetail(**item) for item in instances]
226+
227+
processed_instances = [
228+
{**item, 'InstanceResourceId': item.pop('EcsInstanceId', None)}
229+
for item in instances
230+
]
231+
return [InstanceDetail(**item) for item in processed_instances]
222232
except Exception as e:
223233
logger.error(f"Error in list_instance: {e}")
224234
raise

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)