🔧 修复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:
parent
b5beb9ba0f
commit
8acdabc3a7
|
|
@ -275,7 +275,7 @@ function countMCPTools() {
|
||||||
const serverCode = fs.readFileSync(MCP_SERVER_JS, 'utf8');
|
const serverCode = fs.readFileSync(MCP_SERVER_JS, 'utf8');
|
||||||
|
|
||||||
// 提取 TOOLS 对象区域
|
// 提取 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) {
|
if (!toolsMatch) {
|
||||||
console.log('[MCP-STATS] ⚠️ 无法解析TOOLS注册表');
|
console.log('[MCP-STATS] ⚠️ 无法解析TOOLS注册表');
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue