Skip to main content
Glama

Visum Thinker MCP Server

MIT License
create-prt-with-segment-C.jsโ€ข7.56 kB
import net from 'net'; const pythonCode = ` # ============================================================================ # CREA PROCEDURA PRT ASSIGNMENT CON DEMAND SEGMENT "C" (Car) # ============================================================================ import sys print("=" * 60, file=sys.stderr) print("CREAZIONE PROCEDURA PRT ASSIGNMENT - DEMAND SEGMENT: C", file=sys.stderr) print("=" * 60, file=sys.stderr) # FASE 1: CREA OPERAZIONE IN CODA new_position = 21 operation = visum.Procedures.Operations.AddOperation(new_position, None) operation.SetAttValue("OPERATIONTYPE", 101) # PrT Assignment print(f"FASE 1: Operazione creata in posizione {new_position}", file=sys.stderr) # FASE 2: ACCEDI AI PARAMETRI params = operation.PrTAssignmentParameters print(f"FASE 2: Parametri PrT Assignment accessibili", file=sys.stderr) # FASE 3: CONFIGURA DEMAND SEGMENT "C" try: # Dalla documentazione: l'attributo corretto รจ DSEGSET (DSegSet) # Comma-separated list of demand segments params.SetAttValue("DSEGSET", "C") print(f"FASE 3: DSEGSET = 'C' impostato con successo!", file=sys.stderr) method_used = "DSEGSET" demand_segment_configured = True except Exception as config_error: print(f"ERRORE configurazione demand segment: {config_error}", file=sys.stderr) demand_segment_configured = False method_used = "error" # FASE 4: CONFIGURA PARAMETRI EQUILIBRIUM equilibrium_configured = False try: eq_params = operation.PrTEquilibriumAssignmentParameters # Configura parametri equilibrium eq_params.SetAttValue("NUMITER", 50) # 50 iterazioni eq_params.SetAttValue("PRECISIONDEMAND", 0.01) # Precisione 0.01 print(f"FASE 4: Parametri Equilibrium configurati (50 iter, 0.01 prec)", file=sys.stderr) equilibrium_configured = True config_type = "Equilibrium Assignment" except Exception as eq_error: print(f"FASE 4: Equilibrium params non disponibili: {eq_error}", file=sys.stderr) config_type = "Base PrT Assignment" # FASE 5: VERIFICA FINALE print(f"FASE 5: Verifica configurazione...", file=sys.stderr) operation_type = operation.AttValue("OPERATIONTYPE") print(f"Tipo operazione: {operation_type}", file=sys.stderr) # Verifica che l'operazione esista verification = None try: created_op = visum.Procedures.Operations.ItemByKey(new_position) verification = { "exists": True, "type": created_op.AttValue("OPERATIONTYPE"), "params_accessible": True } print(f"Verifica: OK - operazione {new_position} tipo {verification['type']}", file=sys.stderr) except Exception as e: verification = { "exists": False, "error": str(e) } print(f"Verifica: FALLITA - {e}", file=sys.stderr) print("=" * 60, file=sys.stderr) # RITORNA RISULTATO result = { "status": "ok", "phase_1_creation": "completed", "phase_2_parameter_access": "completed", "phase_3_demand_segment": "completed" if demand_segment_configured else "failed", "phase_4_equilibrium_config": "completed" if equilibrium_configured else "skipped", "phase_5_verification": "completed", "position": new_position, "operation_type": operation_type, "config_type": config_type, "demand_segment": "C", "demand_segment_method": method_used, "demand_segment_configured": demand_segment_configured, "equilibrium_configured": equilibrium_configured, "params_accessible": True, "params_type": str(type(params)), "verification": verification, "ready_to_execute": demand_segment_configured, "note": "Procedura PrT Assignment creata con demand segment 'C' (Car). Pronta per esecuzione." if demand_segment_configured else "Procedura creata ma demand segment non configurato correttamente." } `; const client = new net.Socket(); let welcomeReceived = false; console.log('๐Ÿš€ CREAZIONE PROCEDURA PRT ASSIGNMENT - DEMAND SEGMENT: C'); console.log('=' .repeat(60)); client.connect(7901, '::1', () => { console.log('โœ… Connesso al server TCP sulla porta 7901\n'); }); client.on('data', (data) => { const response = JSON.parse(data.toString()); if (!welcomeReceived && response.type === 'project_welcome') { console.log('๐Ÿ“Š Welcome message ricevuto'); console.log(` Progetto: ${response.projectName}\n`); welcomeReceived = true; const request = { type: 'query', requestId: Date.now(), description: 'Crea procedura PrT Assignment con demand segment C', code: pythonCode }; console.log('๐Ÿ“ค Creazione procedura in corso...\n'); client.write(JSON.stringify(request) + '\n'); } else { console.log('=' .repeat(60)); console.log('๐Ÿ“Š RISULTATO CREAZIONE\n'); if (response.success) { const res = response.result; console.log('โœ… PROCEDURA CREATA CON SUCCESSO!\n'); console.log('๐Ÿ“‹ FASI COMPLETATE:'); console.log(` โœ… FASE 1 (Creazione operazione): ${res.phase_1_creation}`); console.log(` โœ… FASE 2 (Accesso parametri): ${res.phase_2_parameter_access}`); console.log(` ${res.phase_3_demand_segment === 'completed' ? 'โœ…' : 'โŒ'} FASE 3 (Config demand segment): ${res.phase_3_demand_segment}`); console.log(` ${res.phase_4_equilibrium_config === 'completed' ? 'โœ…' : 'โญ๏ธ'} FASE 4 (Config equilibrium): ${res.phase_4_equilibrium_config}`); console.log(` โœ… FASE 5 (Verifica): ${res.phase_5_verification}`); console.log('\n๐Ÿ“Š CONFIGURAZIONE:'); console.log(` ๐Ÿ“ Posizione: ${res.position} (in coda)`); console.log(` ๐Ÿ”ง Tipo operazione: ${res.operation_type} (${res.config_type})`); console.log(` ๐ŸŽฏ Demand Segment: "${res.demand_segment}" (${res.demand_segment_configured ? 'CONFIGURATO' : 'NON CONFIGURATO'})`); if (res.demand_segment_configured) { console.log(` ๐Ÿ“ Metodo usato: ${res.demand_segment_method}`); } console.log(` โš™๏ธ Equilibrium: ${res.equilibrium_configured ? '50 iter, 0.01 prec' : 'Non configurato'}`); if (res.verification) { console.log('\n๐Ÿ” VERIFICA:'); console.log(` Operazione esiste: ${res.verification.exists ? 'โœ… SI' : 'โŒ NO'}`); if (res.verification.exists) { console.log(` Tipo verificato: ${res.verification.type}`); } } console.log('\n๐Ÿ’ก STATO:'); if (res.ready_to_execute) { console.log(' ๐ŸŸข PRONTA PER ESECUZIONE'); console.log(' Per eseguire: visum.Procedures.Execute()'); } else { console.log(' ๐ŸŸก CREATA MA RICHIEDE CONFIGURAZIONE MANUALE'); console.log(' Verifica i demand segments in Visum'); } console.log(`\n๐Ÿ“ NOTA: ${res.note}`); } else { console.log('โŒ ERRORE!\n'); console.log(`Messaggio: ${response.error}`); } console.log(`\nโฑ๏ธ Tempo esecuzione: ${response.executionTimeMs}ms`); console.log('=' .repeat(60)); client.destroy(); } }); client.on('close', () => { console.log('\n๐Ÿ”Œ Connessione chiusa'); }); client.on('error', (err) => { console.error('โŒ Errore:', err.message); });

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/multiluca2020/visum-thinker-mcp-server'

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