🔧 修复TOOLS注册表解析regex使其更健壮

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/052d94ae-8810-4971-bc2a-463f6b003720

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-09 08:05:37 +00:00 committed by GitHub
parent b5beb9ba0f
commit 8acdabc3a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -275,7 +275,7 @@ function countMCPTools() {
const serverCode = fs.readFileSync(MCP_SERVER_JS, 'utf8');
// 提取 TOOLS 对象区域
const toolsMatch = serverCode.match(/const TOOLS\s*=\s*\{([\s\S]*?)^\};/m);
const toolsMatch = serverCode.match(/const TOOLS\s*=\s*\{([\s\S]*?)\n\};/m);
if (!toolsMatch) {
console.log('[MCP-STATS] ⚠️ 无法解析TOOLS注册表');
return result;