> ## Documentation Index
> Fetch the complete documentation index at: https://docs.footstep.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# optimize_stops

> Find the fastest order to visit multiple stops

Given a list of stops, find the most efficient order to visit them all. Solves the travelling salesman problem and returns the optimised route with full terrain analytics, plus a breakdown of how much distance and time you saved compared to the original order.

## Example prompts

* "Find the best order to visit these 8 delivery addresses"
* "I need to visit 5 clients today, what's the most efficient route?"
* "Optimise this list of warehouse stops for a bike courier"
* "Reorder these 12 locations to minimise driving time"

## What you get back

The reordered stop sequence (`optimized_order`), savings vs the original order, and the optimised route's totals (distance, duration, terrain).

When the input order was already optimal, `savings` is omitted and `already_optimal: true` is returned instead — a single boolean rather than a row of zeros.

For step-by-step directions through the optimised order, call `get_directions` with the reordered waypoints.

## Map rendering

Responses include a `render` envelope with a `linestring` layer for the optimised route plus a `point` layer for the ordered stops. Pass `compact: true` for summary-only responses. See [response defaults & controls](/mcp/defaults) for the full flag matrix and [render envelopes](/mcp/render-envelopes) for the layer schema.

## Example response

```json theme={null}
{
  "structuredContent": {
    "optimized_order": [0, 2, 1, 3],
    "savings": { "distance_saved_meters": 500, "time_saved_seconds": 120 },
    "route": { "distance_meters": 12340, "duration_seconds": 2200 },
    "render": [
      { "kind": "linestring", "label": "Optimised route", "data": {/* … */}, "bbox": [/* … */] },
      {
        "kind": "point",
        "label": "Stops in visit order",
        "data": {
          "type": "FeatureCollection",
          "features": [
            { "type": "Feature", "geometry": {/* … */}, "properties": { "order_index": 0, "original_index": 0 } }
          ]
        },
        "bbox": [/* … */]
      }
    ]
  }
}
```
