Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
SuYao 2025-12-04 21:02:12 +08:00 committed by GitHub
parent 0ac3a2dd72
commit 2cac432512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,8 +65,8 @@ export function buildFunctionCallToolName(serverName: string, toolName: string,
}
// Replace invalid characters with underscores
// Keep only a-z, A-Z, 0-9, underscores, dashes, dots, colons (AI model compatible)
name = name.replace(/[^a-zA-Z0-9_.\-:]/g, '_')
// Keep only a-z, 0-9, underscores, dashes, dots, colons (AI model compatible)
name = name.replace(/[^a-z0-9_.\-:]/g, '_')
// Ensure name starts with a letter or underscore (AI model requirement)
if (!/^[a-zA-Z_]/.test(name)) {