visum_network_stats
Retrieve comprehensive network statistics from a loaded Visum project to analyze transportation infrastructure and performance metrics.
Instructions
Get comprehensive network statistics from the loaded Visum project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index-backup.ts:662-711 (registration)MCP tool registration for 'visum_network_stats'. Defines empty schema and thin handler that delegates to PersistentVisumController.getNetworkStats() and formats the markdown response.server.tool( "visum_network_stats", "Get comprehensive network statistics from the loaded Visum project", {}, async () => { try { const result = await visumController.getNetworkStats(); if (result.success) { return { content: [ { type: "text", text: `✅ **Statistiche Rete PERSISTENTE**\n\n` + `**Riepilogo Rete:**\n` + `• **Nodi:** ${result.result?.nodes?.toLocaleString() || 'N/A'}\n` + `• **Link:** ${result.result?.links?.toLocaleString() || 'N/A'}\n` + `• **Zone:** ${result.result?.zones?.toLocaleString() || 'N/A'}\n\n` + `**Performance ULTRA-VELOCE:**\n` + `• **Tempo Query:** ${result.result?.query_time_ms?.toFixed(3) || 'N/A'}ms\n` + `• **Tempo Totale:** ${result.executionTimeMs?.toFixed(3) || 'N/A'}ms\n` + `• **Persistente:** ${result.result?.persistent ? '✅ SÌ' : '❌ NO'}\n\n` + `*Dati recuperati da istanza VisumPy PERSISTENTE - Ultra-veloce!*` } ] }; } else { return { content: [ { type: "text", text: `❌ **Impossibile ottenere statistiche rete**\n\n` + `Il progetto Visum potrebbe non essere caricato o accessibile.\n` + `La prima chiamata potrebbe richiedere più tempo per inizializzare l'istanza VisumPy.` } ] }; } } catch (error) { return { content: [ { type: "text", text: `❌ **Errore ottenimento statistiche rete:**\n\n${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Core handler method in PersistentVisumController that sends optimized Python code to the persistent VisumPy process to query network counts (nodes, links, zones) and measures execution time.public async getNetworkStats(): Promise<VisumResponse> { const code = ` # Ultra-fast network statistics from persistent instance start_time = time.time() nodes = visum.Net.Nodes.Count links = visum.Net.Links.Count zones = visum.Net.Zones.Count elapsed = time.time() - start_time result = { 'nodes': nodes, 'links': links, 'zones': zones, 'query_time_ms': round(elapsed * 1000, 3), 'persistent': True } `; return this.sendCommandToPersistentProcess(code, "Network statistics (persistent)"); }
- src/index-backup.ts:665-665 (schema)Empty input schema (no parameters required).{},
- test-mcp-simulation.py:138-158 (helper)Test simulation of the tool call, demonstrating the network stats Python code execution.# TOOL 1: visum_network_stats result1 = simulate_mcp_tool_call( "visum_network_stats", """ # Basic network statistics nodes = visum.Net.Nodes.Count links = visum.Net.Links.Count zones = visum.Net.Zones.Count result['network_stats'] = { 'nodes': nodes, 'links': links, 'zones': zones, 'timestamp': time.time() } print(f"Network stats: {nodes:,} nodes, {links:,} links, {zones:,} zones") """, "Get basic network statistics" ) all_results.append(result1)