Skip to main content
Glama
build-validate-tools.js1.85 kB
#!/usr/bin/env node // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { readFileSync } from "fs"; import { globSync } from "glob"; import { validateToolName, validateParameterName, extractToolNames, extractParameterNames } from "../dist/shared/tool-validation.js"; /** * Main validation function */ function validateToolsAndParameters() { console.log("🔍 Validating tool names and parameter names...\n"); const toolFiles = globSync("src/tools/*.ts"); let hasErrors = false; for (const filePath of toolFiles) { const fileContent = readFileSync(filePath, "utf-8"); const toolNames = extractToolNames(fileContent); const paramNames = extractParameterNames(fileContent); console.log(`📁 ${filePath}:`); // Validate tool names for (const toolName of toolNames) { const validation = validateToolName(toolName); if (!validation.isValid) { console.error(` ❌ Tool name error: ${validation.error}`); hasErrors = true; } else { console.log(` ✅ Tool: ${toolName} (${toolName.length} chars)`); } } // Validate parameter names for (const paramName of paramNames) { const validation = validateParameterName(paramName); if (!validation.isValid) { console.error(` ❌ Parameter name error: ${validation.error}`); hasErrors = true; } else if (paramName.length > 32) { // Warning for long parameter names console.warn(` ⚠️ Parameter: ${paramName} (${paramName.length} chars - consider shortening)`); } } console.log(""); } if (hasErrors) { console.error("❌ Validation failed! Please fix the errors above."); process.exit(1); } else { console.log("✅ All tool names and parameter names are valid!"); } } validateToolsAndParameters();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/magemaclean/azure-devops-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server