admin/sql/20260729_mcp_tool.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

33 lines
2.0 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.

-- MCP 工具配置(启用/描述覆盖),与代码内置目录合并
-- 对齐 t_system_other_config / t_order_file 等配置表结构习惯
CREATE TABLE IF NOT EXISTS `t_mcp_tool` (
`Id` INT NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
`ToolKey` VARCHAR(64) NOT NULL COMMENT '工具编码,如 oms.price_check',
`DisplayName` VARCHAR(128) NOT NULL COMMENT '显示名称',
`Description` VARCHAR(1000) NOT NULL COMMENT '给 AI 的工具描述',
`Enabled` TINYINT NOT NULL DEFAULT 1 COMMENT '是否启用:0-否,1-是',
`SortOrder` INT NOT NULL DEFAULT 0 COMMENT '排序,越小越靠前',
`Remark` VARCHAR(512) NULL COMMENT '备注',
`IsDeleted` TINYINT NOT NULL DEFAULT 0 COMMENT '软删除:0-否,1-是',
`ConcurrencyStamp` CHAR(36) NOT NULL DEFAULT (UUID()) COMMENT '并发戳',
`CreateUserId` INT NOT NULL DEFAULT 0 COMMENT '创建人',
`CreateTime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`UpdateUserId` INT NULL COMMENT '更新人',
`UpdateTime` DATETIME NULL COMMENT '更新时间',
PRIMARY KEY (`Id`),
UNIQUE KEY `uk_mcp_tool_key` (`ToolKey`),
KEY `idx_mcp_tool_enabled` (`Enabled`, `SortOrder`, `Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MCP 工具配置表';
INSERT INTO `t_mcp_tool` (`ToolKey`, `DisplayName`, `Description`, `Enabled`, `SortOrder`, `Remark`)
VALUES
('oms.price_check', '查价格', '根据目的国、重量等查询运费报价,返回可用渠道与价格摘要。', 1, 10, '内置:封装 /order/price-check'),
('oms.channel_guide', '查渠道对客说明', '按销售产品代码/名称查询对客说明(禁运、可寄品名等),判断客户品名是否可承运。', 1, 20, '内置:读销售产品 CustomerGuideMarkdown'),
('oms.track_query', '查轨迹', '根据运单号/客户单号查询物流轨迹时间轴摘要。', 1, 30, '内置:轨迹中心 GetDetailTimeline')
ON DUPLICATE KEY UPDATE
`DisplayName` = VALUES(`DisplayName`),
`Description` = VALUES(`Description`),
`SortOrder` = VALUES(`SortOrder`),
`Remark` = VALUES(`Remark`);