Skip to main content
Glama
trace-leumi-division1-issue.cjs5.18 kB
const https = require('https'); // Test configuration const MCP_ENDPOINT = 'https://shannon-warrant-discovery-speeds.trycloudflare.com/mcp'; const AUTH_TOKEN = process.env.AUTH_TOKEN; // Pass the Bearer token via environment async function makeRequest(body) { return new Promise((resolve, reject) => { const url = new URL(MCP_ENDPOINT); const options = { hostname: url.hostname, port: url.port || 443, path: url.pathname, method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': AUTH_TOKEN ? `Bearer ${AUTH_TOKEN}` : undefined, 'Accept': 'application/json, text/event-stream' } }; const req = https.request(options, (res) => { let data = ''; res.on('data', (chunk) => data += chunk); res.on('end', () => { try { resolve(JSON.parse(data)); } catch (e) { resolve(data); } }); }); req.on('error', reject); req.write(JSON.stringify(body)); req.end(); }); } async function testBankLeumiDivision1() { console.log('Testing Bank Leumi TestEnv Division 1 Detection\n'); console.log('Expected API key: 57ade50e-c9a8-49f3-8ce7-28d44536a669:24223:1'); console.log('Expected isPpApplied: true\n'); // Test different query variations const queries = [ "show me bank leumi test env cost per month of the last 6 months", "show me bank leumi testenv division 1 costs", "show me BL Test Env costs", "show costs for account key 24223 division 1" ]; for (const query of queries) { console.log(`\n=== Testing query: "${query}" ===`); const request = { jsonrpc: '2.0', method: 'tools/call', params: { name: 'api__invoices_caui', arguments: { accountId: '696314371547', startDate: '2025-03-01', endDate: '2025-09-26', periodGranLevel: 'month', groupBy: 'none', costType: '["cost", "discount"]', userQuery: query } }, id: Math.floor(Math.random() * 1000) }; try { const response = await makeRequest(request); if (response.result) { // Try to extract API key info from the response const responseStr = JSON.stringify(response.result); // Look for evidence of which account was used if (responseStr.includes('24223')) { console.log('✅ Correct account key 24223 detected'); } else if (responseStr.includes('15808')) { console.log('❌ Wrong account key 15808 detected'); } else if (responseStr.includes('22676')) { console.log('❌ Wrong account key 22676 detected'); } // Check for isPpApplied if (responseStr.includes('isPpApplied')) { const match = responseStr.match(/"isPpApplied":\s*(true|false)/); if (match) { console.log(`isPpApplied: ${match[1]}`); } } // Try to get cost data if (response.result.content) { const content = response.result.content[0]; if (content && content.text) { // Extract first few cost values const costMatch = content.text.match(/\$[\d,]+\.\d{2}/g); if (costMatch) { console.log(`Sample costs found: ${costMatch.slice(0, 3).join(', ')}`); } } } } else if (response.error) { console.log('Error:', response.error.message); } } catch (error) { console.error('Request failed:', error.message); } } console.log('\n=== Direct Customer Detection Test ==='); // Test with explicit customer_account_key const directRequest = { jsonrpc: '2.0', method: 'tools/call', params: { name: 'api__invoices_caui', arguments: { accountId: '696314371547', customer_account_key: '24223', // Explicitly set Bank Leumi TestEnv customer_division_id: '1', // Division 1 startDate: '2025-03-01', endDate: '2025-09-26', periodGranLevel: 'month', groupBy: 'none', costType: '["cost", "discount"]', userQuery: 'Bank Leumi TestEnv division 1' } }, id: Math.floor(Math.random() * 1000) }; try { console.log('Testing with explicit customer_account_key=24223, customer_division_id=1'); const response = await makeRequest(directRequest); if (response.result && response.result.content) { const content = response.result.content[0]; if (content && content.text) { const costMatch = content.text.match(/\$[\d,]+\.\d{2}/g); if (costMatch) { console.log(`✅ Costs retrieved: ${costMatch.slice(0, 3).join(', ')}`); } } } } catch (error) { console.error('Direct request failed:', error.message); } } // Check if auth token is provided if (!AUTH_TOKEN) { console.error('Please provide AUTH_TOKEN environment variable'); console.error('Usage: AUTH_TOKEN="Bearer eyJ..." node trace-leumi-division1-issue.cjs'); process.exit(1); } testBankLeumiDivision1().catch(console.error);

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/daviddraiumbrella/invoice-monitoring'

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