Skip to content

Commit 0f8b332

Browse files
调整SDK版本号
1 parent 356a152 commit 0f8b332

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
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.70.2",
11+
"alibabacloud-dms-enterprise20181101>=1.71.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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ async def executeScript(database_id: str, script: str, logic: bool = False) -> D
385385
386386
This tool converts natural language questions into SQL queries that can be executed against a database.
387387
If you don't have the database_id, use the searchDatabase tool first to identify the correct database.
388+
The sql generated could be executed via DMS executeScript tool provided in this server if necessary.
388389
389390
Parameters:
390391
question (str): Natural language question about the database that needs to be converted to SQL.
@@ -394,10 +395,6 @@ async def executeScript(database_id: str, script: str, logic: bool = False) -> D
394395
Returns:
395396
Dict[str, Any]: A dictionary containing:
396397
- Sql (str): The generated SQL query based on the natural language question
397-
- Tables (List[Dict]): Tables referenced in the query
398-
- SimilarSql (List[Dict]): Similar SQL examples that may be helpful
399-
- Success (bool): Whether the conversion was successful
400-
- RequestId (str): Unique request identifier
401398
""")
402399
async def nl2sql(database_id: str, question: str, knowledge: Optional[str] = None) -> Dict[str, Any]:
403400
if not isinstance(question, str) or not question.strip():
@@ -416,7 +413,9 @@ async def nl2sql(database_id: str, question: str, knowledge: Optional[str] = Non
416413
logging.warning("Empty or invalid response received from DMS service")
417414
return []
418415
data = response.body.to_map()
419-
return data
416+
if data:
417+
sql = data.get('Data', {}).get('Sql')
418+
return sql
420419
except Exception as error:
421420
logging.error(error)
422421
raise error

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)