Skip to main content
Glama
validate-project-tools.tsβ€’11.9 kB
/** * Validate the actual project tools from server.ts * * This script extracts the real tool definitions from our MCP server * and validates them using the validation framework. */ import { MCPToolValidator } from './mcp-tool-validator'; import { ValidationReporter } from './validation-reporter'; import { MCPTool } from './types'; /** * Complete list of tools from server.ts _handleToolsList method */ const PROJECT_TOOLS: MCPTool[] = [ { name: 'create_form', description: 'Create a new Tally form with specified fields and configuration', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Form title' }, description: { type: 'string', description: 'Form description' }, fields: { type: 'array', items: { type: 'object', properties: { type: { type: 'string', enum: ['text', 'email', 'number', 'textarea', 'select', 'checkbox', 'radio'] }, label: { type: 'string' }, required: { type: 'boolean' }, options: { type: 'array', items: { type: 'string' } } }, required: ['type', 'label'] } }, settings: { type: 'object', properties: { isPublic: { type: 'boolean' }, allowMultipleSubmissions: { type: 'boolean' }, showProgressBar: { type: 'boolean' } } } }, required: ['title', 'fields'] } }, { name: 'modify_form', description: 'Modify an existing Tally form', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to modify' }, title: { type: 'string', description: 'New form title' }, description: { type: 'string', description: 'New form description' }, fields: { type: 'array', items: { type: 'object', properties: { type: { type: 'string', enum: ['text', 'email', 'number', 'textarea', 'select', 'checkbox', 'radio'] }, label: { type: 'string' }, required: { type: 'boolean' }, options: { type: 'array', items: { type: 'string' } } }, required: ['type', 'label'] } } }, required: ['formId'] } }, { name: 'get_form', description: 'Retrieve information about a specific Tally form', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to retrieve' } }, required: ['formId'] } }, { name: 'list_forms', description: 'List all forms in the authenticated user\'s Tally account', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of forms to return', minimum: 1, maximum: 100 }, offset: { type: 'number', description: 'Number of forms to skip for pagination', minimum: 0 } } } }, { name: 'delete_form', description: 'Delete a Tally form permanently', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to delete' } }, required: ['formId'] } }, { name: 'get_submissions', description: 'Retrieve submissions for a specific Tally form', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to get submissions for' }, limit: { type: 'number', description: 'Maximum number of submissions to return', minimum: 1, maximum: 100 }, offset: { type: 'number', description: 'Number of submissions to skip for pagination', minimum: 0 }, since: { type: 'string', description: 'Only return submissions created after this ISO 8601 timestamp' } }, required: ['formId'] } }, { name: 'analyze_submissions', description: 'Analyze submission data for a Tally form to provide insights and statistics', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to analyze submissions for' }, analysisType: { type: 'string', enum: ['basic_stats', 'response_patterns', 'completion_rates', 'field_analysis'], description: 'Type of analysis to perform' }, dateRange: { type: 'object', properties: { start: { type: 'string', description: 'Start date for analysis (ISO 8601)' }, end: { type: 'string', description: 'End date for analysis (ISO 8601)' } } } }, required: ['formId', 'analysisType'] } }, { name: 'export_submissions', description: 'Export form submissions in various formats', inputSchema: { type: 'object', properties: { formId: { type: 'string', description: 'ID of the form to export submissions for' }, format: { type: 'string', enum: ['csv', 'json', 'xlsx'], description: 'Export format', default: 'csv' }, dateRange: { type: 'object', properties: { start: { type: 'string', description: 'Start date for export (ISO 8601)' }, end: { type: 'string', description: 'End date for export (ISO 8601)' } } }, includeFields: { type: 'array', items: { type: 'string' }, description: 'Specific field IDs to include in export (all fields if not specified)' } }, required: ['formId'] } }, { name: 'manage_workspace', description: 'Manage workspace settings and information', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['get_info', 'update_settings', 'list_members'], description: 'Action to perform on the workspace' }, settings: { type: 'object', properties: { name: { type: 'string', description: 'Workspace name' }, description: { type: 'string', description: 'Workspace description' } } } }, required: ['action'] } }, { name: 'generate_template', description: 'Generate a form template based on requirements or use case', inputSchema: { type: 'object', properties: { templateType: { type: 'string', enum: ['contact', 'survey', 'registration', 'feedback', 'order', 'application', 'custom'], description: 'Type of template to generate' }, requirements: { type: 'string', description: 'Specific requirements or use case description for custom templates' }, fields: { type: 'array', items: { type: 'object', properties: { type: { type: 'string' }, label: { type: 'string' }, required: { type: 'boolean' } } }, description: 'Specific fields to include in the template' } }, required: ['templateType'] } } ]; /** * Validate all project tools and generate a comprehensive report */ export function validateProjectTools(): void { console.log('πŸ” Validating Tally MCP Project Tools'); console.log('=' .repeat(60)); // Create validator with strict configuration const validator = new MCPToolValidator({ strict: true, checkUniqueNames: true, deepValidation: true, includeMetrics: true, mcpVersion: '2024-11-05' }); // Create detailed reporter const reporter = new ValidationReporter({ detailed: true, includeMetrics: true, colorize: true, includeSummary: true, includeToolResults: true }); // Validate all tools const validationReport = validator.generateReport(PROJECT_TOOLS); // Display results if (validationReport.overall.valid) { console.log('πŸŽ‰ SUCCESS: All project tools are valid!'); console.log(`✨ ${validationReport.toolCount} tools validated successfully`); if (validationReport.overall.warnings.length > 0) { console.log(`⚠️ Found ${validationReport.overall.warnings.length} warnings to consider:`); validationReport.overall.warnings.forEach(warning => { console.log(` - ${warning.message}`); }); } } else { console.log('❌ VALIDATION FAILED: Some tools have issues'); console.log(reporter.generateTextReport(validationReport)); } // Always show performance metrics console.log('\nπŸ“Š Performance Metrics:'); console.log('=' .repeat(40)); console.log(` Total validation time: ${validationReport.metrics.validationDurationMs}ms`); console.log(` Rules executed: ${validationReport.metrics.rulesExecuted}`); console.log(` Average time per tool: ${validationReport.metrics.averageTimePerTool.toFixed(2)}ms`); console.log(` Memory usage: ${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`); // Show tool summary console.log('\nπŸ“‹ Tool Summary:'); console.log('=' .repeat(40)); PROJECT_TOOLS.forEach((tool, index) => { const toolResult = validator.validateTool(tool, index); const status = toolResult.valid ? 'βœ…' : '❌'; const issues = toolResult.errors.length > 0 ? ` (${toolResult.errors.length} errors)` : ''; const warnings = toolResult.warnings.length > 0 ? ` (${toolResult.warnings.length} warnings)` : ''; console.log(` ${status} ${tool.name}${issues}${warnings}`); }); // Generate and save detailed reports console.log('\nπŸ’Ύ Generating detailed reports...'); try { const fs = require('fs'); const path = require('path'); // Ensure reports directory exists const reportsDir = path.join(process.cwd(), 'reports'); if (!fs.existsSync(reportsDir)) { fs.mkdirSync(reportsDir, { recursive: true }); } // Save JSON report const jsonReport = reporter.generateJsonReport(validationReport); fs.writeFileSync(path.join(reportsDir, 'tool-validation-report.json'), jsonReport); console.log(' πŸ“„ JSON report saved to: reports/tool-validation-report.json'); // Save CSV report const csvReport = reporter.generateCsvReport(validationReport); fs.writeFileSync(path.join(reportsDir, 'tool-validation-report.csv'), csvReport); console.log(' πŸ“Š CSV report saved to: reports/tool-validation-report.csv'); // Save text report const textReport = reporter.generateTextReport(validationReport); fs.writeFileSync(path.join(reportsDir, 'tool-validation-report.txt'), textReport); console.log(' πŸ“ Text report saved to: reports/tool-validation-report.txt'); } catch (error) { console.warn('⚠️ Could not save reports to files:', error instanceof Error ? error.message : error); } console.log('\n🎯 Validation Framework Features Demonstrated:'); console.log('=' .repeat(60)); console.log('βœ… MCP Protocol v2024-11-05 compliance validation'); console.log('βœ… JSON Schema structure and type validation'); console.log('βœ… Tool name uniqueness and format checking'); console.log('βœ… Description quality and length validation'); console.log('βœ… Required field consistency validation'); console.log('βœ… Schema depth and complexity analysis'); console.log('βœ… Performance metrics and timing analysis'); console.log('βœ… Multi-format report generation (JSON, CSV, TXT)'); console.log('βœ… Real project tool validation'); console.log('\nπŸš€ Tool Schema Validation Framework successfully validates all project tools!'); } // Run the validation if this file is executed directly if (require.main === module) { validateProjectTools(); }

Implementation Reference

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/learnwithcc/tally-mcp'

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