Skip to main content
Glama

Visum Thinker MCP Server

MIT License
test-export-all-tables.json•3.69 kB
{ "method": "tools/call", "params": { "name": "project_execute", "arguments": { "projectId": "S000009result_1278407893", "code": "import xml.etree.ElementTree as ET\nimport os\nlayout_file = r'H:\\go\\reports\\Input\\tabelle_report.lay'\noutput_dir = r'H:\\go\\reports\\Input'\nproject_name = 'S000009result'\ntree = ET.parse(layout_file)\nroot = tree.getroot()\ntables_info = []\nfor list_item in root.iter('listLayoutItem'):\n graphic = list_item.find('.//listGraphicParameterLayoutItems')\n if graphic is not None:\n net_obj_type = graphic.get('netObjectType')\n if net_obj_type:\n table_name_elem = list_item.find('.//caption')\n table_name = table_name_elem.get('text', net_obj_type) if table_name_elem is not None else net_obj_type\n col_defs = []\n for attr_def in list_item.iter('attributeDefinition'):\n col_defs.append(attr_def.attrib)\n tables_info.append({'name': table_name, 'type': net_obj_type, 'columns': col_defs})\ntype_to_collection = {'LINK': 'visum.Net.Links', 'NODE': 'visum.Net.Nodes', 'ZONE': 'visum.Net.Zones', 'ODPAIR': 'visum.Net.ODPairs', 'LINE': 'visum.Net.Lines', 'LINEROUTE': 'visum.Net.LineRoutes', 'TIMEPROFILE': 'visum.Net.TimeProfiles', 'STOP': 'visum.Net.Stops'}\nresults = []\nfor table in tables_info:\n table_type = table['type']\n table_name = table['name']\n collection_path = type_to_collection.get(table_type)\n if not collection_path:\n results.append({'table': table_name, 'status': 'SKIPPED', 'reason': 'Unknown type'})\n continue\n try:\n collection = eval(collection_path)\n count = collection.Count\n except Exception as e:\n results.append({'table': table_name, 'status': 'ERROR', 'reason': str(e)})\n continue\n full_attrs = []\n headers = []\n for col in table['columns']:\n attr_id = col['attributeID']\n sub1 = col.get('subAttributeID1', '')\n sub2 = col.get('subAttributeID2', '')\n sub3 = col.get('subAttributeID3', '')\n if sub1 or sub2 or sub3:\n subs = [s for s in [sub1, sub2, sub3] if s]\n full_attr = attr_id + '(' + ','.join(subs) + ')'\n header = attr_id + '_' + '_'.join(subs)\n else:\n full_attr = attr_id\n header = attr_id\n full_attrs.append(full_attr)\n headers.append(header)\n try:\n data = collection.GetMultipleAttributes(full_attrs)\n lines = [';'.join(headers)]\n for row_tuple in data:\n lines.append(';'.join(str(v) for v in row_tuple))\n safe_name = table_name.replace('/', '_').replace('\\\\', '_').replace(' ', '_')\n output_file = os.path.join(output_dir, f'{project_name}_{safe_name}.csv')\n text = '\\n'.join(lines)\n with open(output_file, 'w', encoding='utf-8', newline='') as f:\n f.write(text)\n size_mb = os.path.getsize(output_file) / (1024 * 1024)\n results.append({'table': table_name, 'type': table_type, 'status': 'SUCCESS', 'file': output_file, 'rows': len(data), 'cols': len(full_attrs), 'size_mb': round(size_mb, 2)})\n except Exception as e:\n results.append({'table': table_name, 'status': 'ERROR', 'reason': str(e)[:100]})\nresult = {'total_tables': len(tables_info), 'successful': len([r for r in results if r['status'] == 'SUCCESS']), 'errors': len([r for r in results if r['status'] == 'ERROR']), 'skipped': len([r for r in results if r['status'] == 'SKIPPED']), 'details': results}\nresult", "description": "Export all tables from layout to CSV" } }, "jsonrpc": "2.0", "id": 30 }

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