- 添加 MySQL 连接管理器,支持连接和查询数据库 - 实现获取表名、描述表结构和执行 SQL 查询的工具 - 增强安全性,防止 SQL 注入和限制查询结果大小 - 更新 README.md,提供 MySQL 配置示例和使用说明 - 添加 MySQL 连接测试脚本,验证连接和工具功能
25 lines
634 B
Python
25 lines
634 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
简单测试 MySQL 工具导入
|
|
"""
|
|
|
|
import sys
|
|
|
|
sys.path.insert(0, ".")
|
|
|
|
try:
|
|
from src.agents.common.toolkits.mysql.tools import mysql_list_tables, mysql_describe_table, mysql_query
|
|
|
|
print("✅ MySQL 工具导入成功")
|
|
print(f"工具列表: {[tool.name for tool in [mysql_list_tables, mysql_describe_table, mysql_query]]}")
|
|
|
|
# 检查工具描述
|
|
for tool in [mysql_list_tables, mysql_describe_table, mysql_query]:
|
|
print(f" - {tool.name}: {tool.description[:60]}...")
|
|
|
|
except Exception as e:
|
|
print(f"❌ 导入失败: {e}")
|
|
import traceback
|
|
|
|
traceback.print_exc()
|