Solve Route
The solve_route tool solves a simple best-path route between a start and end location, with optional intermediate stops and a chosen travel mode such as driving, walking, or trucking.
Tool name
solve_route
Tool alias
Solve Route
Objective
Compute a single best-path route between a start and end location—optionally with ordered intermediate stops and a configured travel mode—against an ArcGIS Network Analysis Server route layer.
Usage guidance
solve_route provides an interface for performing a simple route-solving operation using the Solve Route API of an ArcGIS Network Analysis Server route layer. The tool requires a start and end location, plus an optional stops array of intermediate points and an optional travelMode string. Each location is a point given by its x and y coordinates, with an optional name label that is carried through to the returned directions.
Stops are visited in the given order
The optional stops array is visited in the exact order provided—solve_route does not reorder stops. If the client wants the optimal stop sequence to be computed for them, that is a different operation; see When not to use.
Spatial reference
Input and output spatial references are controlled separately:
inWkid—The spatial reference of the suppliedstart,end, andstopspoints.outWkid—The spatial reference of the returned route geometry.
Both default to 4326 (WGS84). Use outWkid when the route geometry needs to align with a map in a different projection—for example, 3857 for Web Mercator.
Travel mode
The valid travel-mode strings are determined by your deployment's configured route layer, so the exact set varies from one deployment to the next. When the route layer exposes its travel modes, the tool reads the allowed values from it and lists them for the AI assistant. If the travel modes cannot be read from the route layer, none are listed, travelMode accepts any string, and a value that does not match a configured travel mode falls back to the route layer's defaults. A typical route layer exposes values such as:
Driving TimeDriving DistanceTrucking TimeTrucking DistanceWalking TimeWalking DistanceRural Driving TimeRural Driving Distance
Note:
: travel mode strings are case-sensitive.
Follow these rules when deciding which travel mode (if any) to send:
No mention of travel? Do not provide
travelMode. Let the route layer's default travel mode take precedence.Client says "fastest with no mention of mode, or with "driving"? Use the mode closest to
Driving Time.Client says "fastest with "walking"? Use the mode closest to
Walking Time.Client says "shortest" or "closest with no mention of mode, or with "driving"? Use the mode closest to
Driving Distance.Client says "shortest" or "closest with "walking"? Use the mode closest to
Walking Distance.Otherwise, choose the most appropriate value from the travel modes your route layer supports.
Output
The response includes:
The route geometry—an Esri polyline representing the path.
A list of step-by-step directions for navigating the route.
The total distance and duration, with their units.
Important:
Read the unit fields; do not assume units
The output durationUnits and distanceUnits come from the route layer's Network Dataset configuration (directionsTimeAttribute and directionsLengthUnits), not from the travel mode. Always read these unit fields rather than assuming miles and minutes. The same travel mode can return different units on different layers.
If the route layer's metadata cannot be loaded from the configuration, the units fall back to esriNAUMiles and esriNAUMinutes.
Tip:
Simpler requests with a limited number of stops work best.
When to use
- The client wants to solve a simple route problem with a start, an end, optionally a few intermediate stops, and a common travel mode such as driving or walking.
When not to use
The client needs to solve a more specialized routing problem—service area (isochrone) calculations, closest facility, origin-destination cost matrix, or fleet routing.
The client explicitly wants the route optimized, allowing the tool to reorder stops to find the optimal sequence. That is a separate, more computationally expensive operation.
The client needs to provide an input or output spatial reference using
wkt.solve_routeaccepts WKID-based spatial references only.The client needs bulk operations or job submission.
solve_routeis intended for single, synchronous route-solving requests.
Sample prompts to test the tool
Send any of the prompts below to your MCP-compatible AI client to verify that solve_route is working correctly. The prompts are grouped to exercise different inputs and behaviors—from a basic two-point route to each travel mode, ordered intermediate stops, raw WGS84 coordinates, and graceful handling of out-of-coverage requests.
Note:
These prompts are for illustration only. Before you use them, modify them to match the data published in your ArcGIS Enterprise environment.
Basic point-to-point routes
Use the route solver to get turn-by-turn directions and the exact distance and travel time from the Empire State Building, New York to Grand Central Terminal, New York.
Call the routing tool to find the fastest driving route from Los Angeles City Hall to LAX airport—I need the total duration in minutes and the step-by-step directions.
Use the route solver to calculate the shortest driving distance in miles between the White House, Washington DC and the Lincoln Memorial, Washington DC. Show me every direction step.
Travel-mode variations
Use the routing service to solve a
Walking Timeroute from Millennium Park, Chicago to the Art Institute of Chicago. Return the exact walking duration and all direction steps.Call the route solver with
Walking Distancemode from Times Square, New York to Central Park, New York. Give me the precise distance and turn-by-turn instructions.Use the routing tool with
Trucking Timemode to get directions and total travel time from the Port of Los Angeles to 1000 S Alameda St, Los Angeles, CA.Call the route solver using
Trucking Distancemode from Dallas, TX to Houston, TX. Return the total truck route distance and all direction steps.Use the routing service with
Rural Driving Timemode to solve a route from Jackson, Wyoming to the south entrance of Yellowstone National Park. Give me the duration and directions.
Multi-stop routes
Use the route solver to plan a
Driving Timeroute from San Francisco, CA to Los Angeles, CA with intermediate stops at San Jose, CA and Santa Barbara, CA. Return the total distance, total duration, and every direction step.Call the routing tool to solve a
Driving Distanceroute starting at 350 Fifth Avenue, New York, stopping at 30 Rockefeller Plaza, New York and then 1 Times Square, New York, ending at JFK Airport, New York. Give me the full step-by-step directions and total mileage.Use the route solver with
Walking Timemode from the Lincoln Memorial, Washington DC through the Washington Monument and the National Mall, ending at the US Capitol. Return the exact walking time and all navigation steps.
Using coordinates directly
Call the route solver with these WGS84 coordinates—start: x: -73.9857, y: 40.7484 (Empire State Building), end: x: -73.9654, y: 40.7829 (Central Park). Use
Driving Timemode and return the duration and all direction steps.Use the routing service to solve a
Walking Distanceroute from x: -87.6298, y: 41.8781 to x: -87.6233, y: 41.8827 in Chicago. Give me the precise distance and turn-by-turn directions.
Out-of-coverage cases
Use the route solver to get turn-by-turn directions and exact travel time from 10 Downing Street, London to Buckingham Palace, London.
Call the routing service to calculate the exact
Driving Timeroute from the Taj Mahal, Agra to New Delhi Railway Station, India. Return the full duration and turn-by-turn instructions.