AgentSUMO

v0.1.3
io.github.mw-jeong/agentsumo-mcp Checked 2 hours ago Published 14 days ago

MCP server for LLM-driven SUMO traffic simulation, scenario design, and result analysis.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

osm_extract

[Step 1/5] Extract OpenStreetMap (OSM) road network data for a given area. This is the FIRST step in the simulation pipeline. It downloads or extracts raw OSM data (.osm file) for the specified geographic area. Next step: Use net_convert() to convert the .osm file to SUMO .net.xml format. === AREA SPECIFICATION (priority order) === 1. bbox: Direct coordinates [west, south, east, north] Example: [127.015, 37.490, 127.040, 37.506] 2. od_data_file: Auto-compute bbox from OD CSV coordinate columns (use column_mapping if columns are not named O_lon, O_l…

ParameterTypeDescription
city_en *string
bboxarray
citystring
column_mappingobject
od_data_filestring
output_dirstring
radiusnumber
zone_shp_filestring

net_convert

[Step 2/5] Convert OSM data to SUMO network format (.net.xml). Converts the raw .osm file from osm_extract() into a SUMO-compatible road network using netconvert. Applies road type filtering and UTM projection. Previous step: osm_extract() to get .osm file and bbox. Next step: trip_generate() to create traffic demand on this network. === PARAMETERS === - osm_file (REQUIRED): Path to .osm file (from osm_extract result) - city_en: English name for output file naming (auto-derived from osm_file if omitted) - bbox: Bounding box [west, south, east, north] for…

ParameterTypeDescription
osm_file *string
bboxarray
city_enstring
output_dirstring

trip_generate

[Step 3/5] Generate trip demand (trips.xml) for SUMO simulation. Creates origin-destination trip definitions. This tool ONLY generates trips — route assignment is done separately by route_generate(). Previous step: net_convert() to get .net.xml file. Next step: route_generate() to assign routes to trips. === THREE MODES === 1. RandomOD — Random trip generation: - trip_type: "RandomOD" - traffic_condition (REQUIRED): "light" | "medium" | "heavy" * light: ~20% of edge count (rural, off-peak) * medium: ~80% of edge count (typica…

ParameterTypeDescription
net_file *string
trip_type *string
column_mappingobject
od_data_filestring
od_typestring
output_dirstring
traffic_conditionstring
zone_shp_filestring

route_generate

[Step 4/5] Generate routes from trips using SUMO's duarouter. Assigns shortest-path routes to each trip based on the road network. Converts trips.xml → routes.rou.xml which is required for simulation. Previous step: trip_generate() to get .trips.xml file. Next step: sumo_runner() to run the simulation with net_file and route_file. === PARAMETERS === - net_file (REQUIRED): Path to SUMO network file (.net.xml, from net_convert) - trip_file (REQUIRED): Path to trip file (.trips.xml, from trip_generate) === RETURNS === - route_file: Path to generated…

ParameterTypeDescription
net_file *string
trip_file *string
output_dirstring

sumo_runner

[Step 5/5] Run SUMO traffic simulation using TraCI. Executes the simulation with the generated network and routes. Captures vehicle position frames for post-simulation replay visualization. Previous step: route_generate() to get .rou.xml file. === PARAMETERS === - net_file (REQUIRED): SUMO network file (.net.xml, from net_convert) - route_file: Route file (.rou.xml, from route_generate) — preferred over trip_file - trip_file: Trip file (.trips.xml) — use only if route_file is unavailable - duration: Simulation duration in seconds (default: 3600 = 1 h…

ParameterTypeDescription
net_file *string
additional_filesarray
durationinteger
output_dirstring
policy_typestring
route_filestring
trip_filestring

edge_edit_tool

Delete specific road segments from the network file. ⚠️🚨 CRITICAL: After using this tool, you MUST regenerate trips and routes! Route files contain explicit edge lists - if those edges are deleted, the route file becomes INVALID! Workflow: edge_edit_tool → trip_generate → route_generate → sumo_runner (REQUIRED!) 🌟 REALISTIC USAGE: Specify reference_location + radius_km for partial road closure! Three modes (priority order): 1. edge_ids: Delete exact edges (most precise, but requires knowing edge IDs) 2. target_road_name + reference_location +…

ParameterTypeDescription
net_file *string
edge_idsarray
output_dirstring
radius_kmnumber
reference_locationstring
route_filestring
target_road_namestring

reduce_lanes_tool

Reduce lanes on road segments with two modes. ✅ Trip file can be reused - edges still exist, only lane count changed. Workflow: reduce_lanes_tool → sumo_runner (reuse existing trip file) **MODE 1: Relative Reduction (RECOMMENDED for most policies)** - reduce_by: Reduce N lanes from each segment - Example: reduce_by=1 → 5→4, 3→2, 2→1, 1→1 (balanced reduction) **MODE 2: Absolute Reduction (for special cases)** - remain_lanes: Set all segments to N lanes - Example: remain_lanes=1 → 5→1, 3→1, 2→1, 1→1 (extreme reduction) REALISTI…

ParameterTypeDescription
net_file *string
edge_idsarray
output_dirstring
radius_kmnumber
reduce_byinteger
reference_locationstring
remain_lanesinteger
route_filestring
target_road_namestring

speed_limit_edit_tool

Modify speed limits on specific road segments (supports partial application). ✅ Trip file can be reused - edges still exist, only speed limit changed. Workflow: speed_limit_edit_tool → sumo_runner (reuse existing trip file) REALISTIC USAGE: Use reference_location + radius_km for localized speed limit changes! Examples: # REALISTIC: Reduce speed to 40km/h on 500m of Teheran-ro near Gangnam Station speed_limit_edit_tool( net_file="gangnam_station.net.xml", target_road_name="테헤란로", reference_location="강남ì—…

ParameterTypeDescription
net_file *string
edge_idsarray
new_speed_kmphnumber
output_dirstring
radius_kmnumber
reference_locationstring
route_filestring
target_road_namestring

vehicle_generation_tool

Add vehicles from source to destination with optimal path calculation. SUPPORTS TWO MODES: 1. Road Name Mode: - Use exact road names (e.g., '테헤란로', '강남대로') - Set use_geocoding=False (default) 2. Location Mode (Recommended): - Use any location name or place (e.g., '강남역', '코엑스', 'Gangnam Station, Seoul') - Uses geocoding to find coordinates, then finds nearest edges - Set use_geocoding=True - Automatically validates if location is within network bounds IMPORTANT NOTES: - Location Mode validates coo…

ParameterTypeDescription
destination_location *string
net_file *string
route_file *string
source_location *string
depart_timenumber
depart_time_rangearray
output_dirstring
search_radiusnumber
use_geocodingboolean
vehicle_countinteger
vehicle_idstring

flow_generation_tool

Generate a SUMO flow from source to destination. Two ways to specify locations: 1. Place names (source/dest) — uses geocoding to find coordinates 2. Direct coordinates (source_lat/lon, dest_lat/lon) — skips geocoding. Use this when coordinates are already known (e.g., from map O/D selection). Two ways to specify vehicle count (exactly one required): 1. vehs_per_hour — rate-based generation (SUMO <flow vehsPerHour="N">) 2. number — total vehicle count over [begin,end] (SUMO <flow number="N">) Safety parameters applied: departLane="free", depart…

ParameterTypeDescription
net_file *string
route_file *string
beginnumber
deststring
dest_latnumber
dest_lonnumber
endnumber
flow_idstring
numberinteger
output_dirstring
search_radiusnumber
sourcestring
source_latnumber
source_lonnumber
use_geocodingboolean
vehs_per_hourinteger

validate_od_coordinates_tool

Validate a list of coordinates against the SUMO network. Use this BEFORE generating flows to check which coordinates are within the network and find the nearest edges. Essential for agentic OD planning — lets you verify destinations are reachable before proposing them to the user. Args: net_file: SUMO network file path (.net.xml) coordinates: List of coordinate dicts, each with: - lat (float): Latitude (WGS84) - lon (float): Longitude (WGS84) - label (str, optional): Human-readable label (e.g., "Lincoln Tunnel")…

ParameterTypeDescription
coordinates *array
net_file *string
search_radiusnumber

vehicle_type_edit_tool

Reassign vehicle types in the route file according to the electric_ratio. Args: route_file: Route file path electric_ratio: Ratio of electric vehicles (0.0 to 1.0) output_dir: Output directory for results

ParameterTypeDescription
electric_ratio *number
route_file *string
output_dirstring

tls_offset_tool

Run SUMO tlsCoordinator.py to optimize traffic light offsets and generate an additional XML file. Args: net_file: Network file path (tag will be extracted from filename) route_file: Route file path output_dir: Output directory for results

ParameterTypeDescription
net_file *string
route_file *string
output_dirstring

tls_adaptation_tool

Run SUMO tlsCycleAdaptation.py to optimize traffic light cycles and generate an additional XML file. Args: net_file: Network file path (tag will be extracted from filename) route_file: Route file path output_dir: Output directory for results

ParameterTypeDescription
net_file *string
route_file *string
output_dirstring

xml_to_sqlite_tool

Convert SUMO XML results to SQLite database for advanced SQL-based analysis. IMPORTANT: This enables detailed queries that summary statistics cannot answer: - Top N queries (e.g., "What are the top 10 roads by density?") - Specific edge analysis (e.g., "What is the congestion level at the Gangnam Station intersection?") - Comparative analysis (e.g., "How did density change before and after the policy?") - Temporal analysis (e.g., "How does speed vary across times of day?") - Road-level aggregation (e.g., "What is the average congestion across all of Teheran-ro?")…

ParameterTypeDescription
edgedata_emission_xml *string
edgedata_xml *string
tripinfo_xml *string
descriptionstring
net_filestring
output_dirstring
route_filestring
simulation_idstring
summary_xmlstring

simulation_report_tool

Generate a comprehensive HTML simulation analysis report from SQLite database. This is the FINAL deliverable of a simulation analysis session. It summarizes ALL scenarios in the database with KPIs, comparisons, congestion analysis, and emissions. The report is a standalone dark-themed HTML file that can be: - Viewed in the web interface (click from file tree) - Opened in any browser - Shared as a file IMPORTANT — Before calling this tool: 1. Query the database (read_query) to understand the simulation results 2. Write an executive_summary (1-2 para…

ParameterTypeDescription
db_path *string
executive_summarystring
output_dirstring

network_summary_tool

Get a comprehensive summary of a SUMO network. Use when user asks about the network, its size, or what roads are included. Returns edge count, junction count, total road length, bounding box, and road name list. Args: net_file: Path to the SUMO network file (.net.xml) Returns: Dict with network statistics and road names

ParameterTypeDescription
net_file *string

route_analysis_tool

Analyze the optimal route between two locations in the network. Accepts place names (e.g., "강남역", "Gangnam Station") or road names (e.g., "테헤란로"). TWO ROUTING MODES: 1. "distance" (default): Shortest path by edge length. Works without simulation data. 2. "traveltime": Optimal path using actual simulation results (edgedata XML) as edge weights. Requires weight_file (edgedata XML from a previous simulation). Can also use other attributes: "density", "CO2_abs", etc. Use cases: - "What is the shortest path from Gangnam Station to Samseong…

ParameterTypeDescription
destination *string
net_file *string
origin *string
compare_net_filestring
compare_weight_filestring
routing_modestring
weight_attributestring
weight_filestring

visualize_net_tool

Visualize a SUMO network file and save as PNG image. ⚠️ IMPORTANT: Only use when user EXPLICITLY requests visualization! - User says "show network map", "visualize network" → Use this - User asks about simulation results → Do NOT use, answer with text Args: net_file: Path to the SUMO network file (.net.xml) output_dir: Output directory for visualization files

ParameterTypeDescription
net_file *string
output_dirstring

visualize_edge_tool

Visualize a SUMO network file with selected edges highlighted and save as PNG image. Only use when user EXPLICITLY requests edge visualization! - User says "show edge details", "visualize this road" → Use this - User asks "which road is congested?" → Do NOT use, answer with text Args: net_file: Path to the SUMO network file (.net.xml) road_name: Name of the road to highlight output_dir: Output directory for visualization files

ParameterTypeDescription
net_file *string
road_name *string
output_dirstring

visualize_policy_target_tool

Visualize policy target area using SUMO's built-in visualization. Only use when user EXPLICITLY requests to preview policy area! - User says "show me which roads will be affected" → Use this - User just wants to apply policy → Do NOT use, proceed with policy tool This tool helps visualize which road segments will be affected by a policy before actually applying it. Essential for confirming policy target area! VISUALIZATION: - Shows ONLY the selected road segments within the specified radius - Uses SUMO's standard plot_net_selection.py for consistent…

ParameterTypeDescription
net_file *string
target_road_name *string
output_dirstring
radius_kmnumber
reference_locationstring

analyze_road_details_tool

Analyze detailed road information (lanes, speed limits, length, etc.). This tool provides comprehensive analysis of road segments including: - Number of lanes per segment - Speed limits (km/h) - Road length and width - Statistical summary (averages, min/max) USE CASES: 1. "Show lane count and speed limit for the 500m segment of Teheran-ro near Gangnam Station" 2. "Analyze current road state to compare before and after policy application" 3. "Road capacity analysis (lane count x length)" Args: net_file: Network file path target_roa…

ParameterTypeDescription
net_file *string
target_road_name *string
include_lane_detailsboolean
radius_kmnumber
reference_locationstring

visualize_edgedata_tool

🎨 Visualize SUMO edgedata with flexible scaling modes for comparison. ⚠️ IMPORTANT: Only use when user EXPLICITLY requests heatmap/visualization! - User says "show heatmap", "visualize density", "show congestion map" → Use this - User asks "which road is congested?" -> Do NOT use; answer with text from SQL query **SCALE MODES:** 1. **'auto'** (default): Dynamic scale from current file - Best for: Single simulation analysis - Scale: Optimized for current data range 2. **'unified'**: Consistent scale across multiple files - B…

ParameterTypeDescription
edgedata_file *string
net_file *string
attributestring
comparison_filesarray
max_valuenumber
min_valuenumber
output_dirstring
scale_modestring

get_road_names_tool

Convert SUMO edge IDs to actual road names using edge.getName(). IMPORTANT: Use this after congestion analysis to show human-readable road names! This tool maps SUMO's technical edge IDs to real-world street names, making analysis results much more understandable and actionable. Args: edge_ids: List of SUMO edge IDs to convert (e.g., ["194926855#1", "420901920#0"]) net_file: Network file path used in simulation. When working with DB data, get this from: SELECT net_file FROM simulations WHERE simulation_id = '<your_sim_…

ParameterTypeDescription
edge_ids *array
net_file *string

get_edge_ids_from_road_name_tool

Convert road name to SUMO edge IDs using edge.getName(). IMPORTANT: Use this when user asks questions with road names (e.g., "What is the density of Teheran-ro?") This tool maps human-readable road names to SUMO's technical edge IDs, enabling SQL queries based on road names. Args: road_name: Road name (e.g., "테헤란로", "강남대로", "9th Avenue") net_file: Network file path used in simulation. When working with DB data, get this from: SELECT net_file FROM simulations WHERE simulation_id = '<your_sim_id>' Re…

ParameterTypeDescription
net_file *string
road_name *string

web_search_tool

Search the web using DuckDuckGo. Use this to look up real-world information that helps with simulation scenario design. Useful for: - Venue/facility capacity (e.g., "Madison Square Garden capacity") - Geographic/infrastructure info (e.g., "bridges connecting Manhattan to Brooklyn") - Traffic patterns and event schedules - Road/highway specifications - Any factual information needed to set realistic simulation parameters Args: query: Search query string. Be specific for better results. max_results: Number of results to return (default: 5, m…

ParameterTypeDescription
query *string
max_resultsinteger