Skip to main content
Glama

Automation Script Generator MCP Server

test-validation.js4.84 kB
#!/usr/bin/env node /** * Test script for MCP Server Schema Validation * This demonstrates how the schema validation works */ import { AutomationScriptGenerator } from './index.js'; // Mock the MCP Server components for testing class MockServer { setRequestHandler() { } connect() { } } class MockTransport { } // Override the imports for testing global.Server = MockServer; global.StdioServerTransport = MockTransport; async function testValidation() { console.log('🧪 Testing MCP Server Schema Validation\n'); const generator = new AutomationScriptGenerator(); // Test cases const testCases = [ { name: 'Valid fetch_notion_scenarios', tool: 'fetch_notion_scenarios', args: { database_id: 'test-db-123', filter: { tags: ['LOGIN'], status: 'ready' } }, shouldPass: true }, { name: 'Invalid fetch_notion_scenarios (missing required)', tool: 'fetch_notion_scenarios', args: { filter: { tags: ['LOGIN'] } // Missing required database_id }, shouldPass: false }, { name: 'Invalid fetch_notion_scenarios (extra properties)', tool: 'fetch_notion_scenarios', args: { database_id: 'test-db-123', invalid_property: 'should not be here' }, shouldPass: false }, { name: 'Valid generate_feature_file', tool: 'generate_feature_file', args: { scenario_title: 'User Login', gherkin_syntax: 'Given I am on login page\nWhen I enter credentials\nThen I should be logged in', tags: ['@login', '@smoke'], output_path: './test.feature' }, shouldPass: true }, { name: 'Invalid generate_feature_file (empty scenario_title)', tool: 'generate_feature_file', args: { scenario_title: '', // Empty string should fail minLength: 1 gherkin_syntax: 'Given I am on login page', output_path: './test.feature' }, shouldPass: false }, { name: 'Valid review_and_enhance_code', tool: 'review_and_enhance_code', args: { file_paths: ['./test1.js', './test2.js'], review_criteria: ['docs', 'pom', 'functions'], repo_path: './repo' }, shouldPass: true }, { name: 'Invalid review_and_enhance_code (empty file_paths)', tool: 'review_and_enhance_code', args: { file_paths: [], // Empty array should fail minItems: 1 review_criteria: ['docs'] }, shouldPass: false }, { name: 'Invalid review_and_enhance_code (invalid criteria)', tool: 'review_and_enhance_code', args: { file_paths: ['./test.js'], review_criteria: ['invalid_criteria'] // Not in enum }, shouldPass: false } ]; let passed = 0; let failed = 0; for (const testCase of testCases) { try { generator.validateArgs(testCase.tool, testCase.args); if (testCase.shouldPass) { console.log(`✅ PASS: ${testCase.name}`); passed++; } else { console.log(`❌ FAIL: ${testCase.name} (expected to fail but passed)`); failed++; } } catch (error) { if (!testCase.shouldPass) { console.log(`✅ PASS: ${testCase.name} (correctly failed)`); console.log(` └─ Error: ${error.message}\n`); passed++; } else { console.log(`❌ FAIL: ${testCase.name} (expected to pass but failed)`); console.log(` └─ Error: ${error.message}\n`); failed++; } } } console.log(`\n📊 Test Results:`); console.log(` Passed: ${passed}`); console.log(` Failed: ${failed}`); console.log(` Total: ${testCases.length}`); if (failed === 0) { console.log(`\n🎉 All tests passed! Schema validation is working correctly.`); } else { console.log(`\n⚠️ Some tests failed. Please check the validation logic.`); } } // Only run if this file is executed directly if (import.meta.url === `file://${process.argv[1]}`) { testValidation().catch(console.error); } export { testValidation };

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/raymondsambur/automation-script-generator'

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