This commit is contained in:
nasir@endelospay.com
2025-07-11 20:22:12 +05:00
commit 8c74b0e23f
120 changed files with 206874 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
#!/usr/bin/env node
/**
* Test Provider Registration Tool
* Verifies the public_create_providerregister tool matches the curl request parameters
*/
console.log('🔍 Testing Provider Registration Tool...\n');
// Import the MCP server modules
import('./src/tools/ToolGenerator.js').then(async ({ ToolGenerator }) => {
import('./src/proxy/ApiClient.js').then(async ({ ApiClient }) => {
import('./src/auth/AuthManager.js').then(async ({ AuthManager }) => {
import('./src/config/ConfigManager.js').then(async ({ ConfigManager }) => {
try {
console.log('📋 Loading MCP server components...');
// Initialize components
const config = new ConfigManager();
const authManager = new AuthManager(null, config.getAll(true));
const apiClient = new ApiClient(config.getAll(true), authManager);
const toolGenerator = new ToolGenerator(apiClient, authManager);
console.log('✅ Components loaded successfully\n');
// Generate tools
console.log('🔧 Generating tools...');
const tools = toolGenerator.generateAllTools();
// Find the provider registration tool
const providerRegisterTool = tools.find(tool =>
tool.name === 'public_create_providerregister' ||
tool.name.includes('providerregister') ||
(tool.name.includes('provider') && tool.name.includes('register'))
);
if (providerRegisterTool) {
console.log('✅ Found Provider Registration Tool:');
console.log(`Tool Name: ${providerRegisterTool.name}`);
console.log(`Description: ${providerRegisterTool.description}`);
console.log('');
// Check parameters
const properties = providerRegisterTool.inputSchema?.properties || {};
const required = providerRegisterTool.inputSchema?.required || [];
console.log('📋 Tool Parameters:');
console.log('Required Parameters:');
required.forEach(param => {
const prop = properties[param];
console.log(` - ${param}: ${prop?.type || 'unknown'} (${prop?.description || 'no description'})`);
});
console.log('\nOptional Parameters:');
Object.keys(properties).filter(param => !required.includes(param)).forEach(param => {
const prop = properties[param];
console.log(` - ${param}: ${prop?.type || 'unknown'} (${prop?.description || 'no description'})`);
});
// Compare with curl request parameters
console.log('\n🔍 Comparing with curl request parameters:');
const curlParams = [
'firstName', 'lastName', 'emailAddress', 'textMessageNumber',
'accessRights', 'username', 'newUserPassword', 'confirm_password',
'company_name', 'on_your_domain', 'dummy'
];
const toolParams = Object.keys(properties);
console.log('\nCurl parameters vs Tool parameters:');
curlParams.forEach(param => {
const inTool = toolParams.includes(param);
const status = inTool ? '✅' : '❌';
console.log(`${status} ${param} - ${inTool ? 'Found in tool' : 'Missing from tool'}`);
});
console.log('\nTool parameters not in curl:');
toolParams.filter(param => !curlParams.includes(param)).forEach(param => {
console.log(`⚠️ ${param} - Extra parameter in tool`);
});
// Test parameter validation
console.log('\n🧪 Testing parameter validation:');
const testData = {
firstName: "Test",
lastName: "Provider",
emailAddress: "test@example.com",
textMessageNumber: "(555) 123-4567",
accessRights: {
admin: true,
practitioner: false,
patientPortal: false
},
username: "testprovider",
newUserPassword: "TestPassword123!",
confirm_password: "TestPassword123!",
company_name: "Test Company",
on_your_domain: true,
dummy: "true"
};
// Check if all required parameters are present
const missingRequired = required.filter(param => !(param in testData));
if (missingRequired.length === 0) {
console.log('✅ All required parameters present in test data');
} else {
console.log(`❌ Missing required parameters: ${missingRequired.join(', ')}`);
}
console.log('\n✅ Provider Registration Tool verification complete!');
} else {
console.log('❌ Provider Registration Tool NOT FOUND!');
// Show tools that might be related
const relatedTools = tools.filter(tool =>
tool.name.includes('provider') ||
tool.name.includes('register')
);
console.log(`\n🔍 Found ${relatedTools.length} related tools:`);
relatedTools.forEach(tool => {
console.log(` - ${tool.name}: ${tool.description}`);
});
}
} catch (error) {
console.error('❌ Error:', error.message);
console.error(error.stack);
}
}).catch(error => {
console.error('❌ Error loading ConfigManager:', error.message);
});
}).catch(error => {
console.error('❌ Error loading AuthManager:', error.message);
});
}).catch(error => {
console.error('❌ Error loading ApiClient:', error.message);
});
}).catch(error => {
console.error('❌ Error loading ToolGenerator:', error.message);
});