Plan routes for one or more drivers
plan_routesSplit up to 100 stops across up to 10 drivers from one depot and put each driver's stops in the best order on real roads (Great Britain and US), within a shift length including time at each stop. Each driver gets google_maps_links: the day as chained Google Maps links of up to 9 stops each, every link starting where the last one ended (the Maps app takes about 10 stops a route), so a driver opens the first and then the next; plus google_maps_link_all_stops, one link with every stop, for a desktop browser. Stops that do not fit or cannot be reached come back in unassigned with the reason. A driver over the daily driving limits (EU/UK 9 hours, US 11) gets driving_limit_warning; low bridges under 4.6 m near a driver's road come back as low_bridges (advisory). The map of each driver's stops, numbered in order, shows in the chat by itself (no road line: the Google Maps links are the route). Set render to true only when the user wants to keep or share the map: it returns a link, GeoJSON and KML, and update_map can change it later. A kept route map carries each driver's Google Maps links. Set driver_links to true when the drivers should tick stops off on their phones or the customers should be able to follow their delivery: each driver then gets driver_link (a page for the phone: the stops in order, done / no answer / rescheduled, a note or a photo) and each stop gets tracking_link to send to that customer (how many stops are ahead of them and when it was delivered, as the driver ticks stops off; it is not a live position on a map). The links work for 90 days. Set start_time (the clock time the drivers leave the depot, such as "09:00") when customers are told a timeframe: each stop then gets window (a two-hour slot around its expected arrival; window_minutes changes the width) and customer_message, a short message ready to paste into WhatsApp or a text, with the timeframe and, when driver_links is on, that customer's tracking link. Give from_name (the business) so the message and the tracking page say who the delivery is from. The message names no day: add "today" or the date yourself if the user wants it. Give each stop the customer's name so the message can greet them. The times are estimates from typical traffic, so say so.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"depot": "<depot>"
},
"name": "plan_routes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depot | Yes | Where the drivers start: an address or {lat, lng}. | |
| stops | No | Addresses, or {id, name, address} / {id, name, lat, lng}. name labels the stop on the map and in the plan. | |
| title | No | The kept map's title when render is on, and the day's name on the drivers' pages. | |
| render | No | Also keep the map: a link to share with the drivers, GeoJSON and KML. | |
| source | No | Instead of typing rows: { sheet: "<Google Sheets link>", tab?: "Sites" } (shared with the InstaMaps service account, or viewable by anyone with the link), { file: "<Drive link to a CSV or Excel file>" }, or { run: "<run_id from an earlier answer>" }. Columns are found by their headers (id, name, address or its parts, lat/lng); name them if they aren't obvious (id_column, address_column, lat_column, lng_column; from_column and to_column for road distances). Rows with coordinates are used as they are. | |
| drivers | No | ||
| traffic | No | weekday (default): road times with the area's measured weekday slowdown (DfT delay on local 'A' roads by council and on motorways in Great Britain; the Urban Mobility Report's Travel Time Index by US urban area). free_flow: empty roads. | weekday |
| from_name | No | The business the deliveries are from: named in customer_message and at the top of each tracking page. | |
| start_time | No | The clock time the drivers leave the depot, such as "09:00" or "8:30am". Each stop then gets window and customer_message. | |
| shift_hours | No | ||
| driver_links | No | Also make a check-off page for each driver's phone (driver_link) and a tracking page for each stop's customer (tracking_link). | |
| window_minutes | No | How wide each customer's timeframe is, in minutes (with start_time). | |
| return_to_depot | No | ||
| service_minutes | No | Time spent at each stop. |