admin/sql/20260729_mcp_tool_alter_align.sql
zzh 7c410b1625 feat: 新增轻量 MCP 工具与 AI Agent,并限制 token 滥用
提供查价格/对客说明/查轨迹工具与管理接口;扩展 LLM function calling;按用户 Redis 限流并压缩上下文与工具结果。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 12:03:45 +08:00

39 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 若已按旧版建过 t_mcp_tool,执行本脚本补齐字段(幂等)
ALTER TABLE `t_mcp_tool`
ADD COLUMN IF NOT EXISTS `Remark` VARCHAR(512) NULL COMMENT '备注' AFTER `SortOrder`;
-- MySQL 8.0.12 前无 IF NOT EXISTS 时,可改用下面手工判断;8.0.29+ 支持 ADD COLUMN IF NOT EXISTS
-- 并发戳:已存在则跳过
SET @col_exists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 't_mcp_tool'
AND COLUMN_NAME = 'ConcurrencyStamp'
);
SET @sql := IF(
@col_exists = 0,
'ALTER TABLE `t_mcp_tool` ADD COLUMN `ConcurrencyStamp` CHAR(36) NOT NULL DEFAULT (UUID()) COMMENT ''并发戳'' AFTER `IsDeleted`',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @idx_exists := (
SELECT COUNT(*) FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 't_mcp_tool'
AND INDEX_NAME = 'idx_mcp_tool_enabled'
);
SET @sql := IF(
@idx_exists = 0,
'ALTER TABLE `t_mcp_tool` ADD KEY `idx_mcp_tool_enabled` (`Enabled`, `SortOrder`, `Id`)',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
ALTER TABLE `t_mcp_tool` COMMENT = 'MCP 工具配置表';