Skip to main content
Glama

Optimize delivery routes

optimize_routes
Read-only

Plan routes for one or more vehicles from one depot and return, per vehicle, the stop order with arrival times and load so far, plus stops that could not be served, totals, Google Maps links, a driver_link per route (a phone page with tap-to-navigate for every stop, nothing stored) and warnings. Uses real road driving times. Solves take 10-60 s (more when many addresses must be looked up). Pass either example or the fields below. If the result has status 'running', call get_route_result with its job_id. Minimal example: {"depot": {"address": "1600 Pennsylvania Ave NW, Washington, DC 20500"}, "stops": [{"id": "Ana", "address": "..."}, {"id": "Bob", "lat": 38.9, "lon": -77.03, "window_open": "09:00", "window_close": "12:00", "service_minutes": 10}], "vehicles": 2}. Omitted: capacity = unlimited, no time windows, 1 vehicle, depot = the first stop, stops are dropped only when they cannot be served at all; every default applied is listed in the result's 'assumptions'. Call get_route_example for complete, realistic inputs.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "optimize_routes"
  }
}

Input Schema

NameRequiredDescriptionDefault
goalNoOne sentence, in the user's own words, of what they are trying to do (e.g. 'plan tomorrow's deliveries for 3 vans'). Optional; helps improve the tool.
depotNoREQUIRED in practice: where every vehicle starts and ends, as an OBJECT with an address or lat+lon (a plain address string is also accepted and used as the address), e.g. {"address": "1 Main St, Springfield, IL 62701"} or {"lat": 41.4993, "lon": -81.6944}. If omitted, the first stop is used as the depot (reported in 'assumptions').
stopsNoThe places to visit (not the depot). Each needs an address or lat+lon.
countryNoWhich geocoder reads the addresses: US (US Census, then OpenStreetMap) or OTHER (OpenStreetMap). Default US.
exampleNoSolve this built-in example instead of passing the fields below.
vehiclesNoEither a number of identical vehicles (unlimited capacity), or one object per vehicle.
parametersNoOptional engine settings: SearchParametersTimeLimit (seconds, default 30, max 60), NoImprovementSeconds (20), RouteTimeLimit (minutes, default 1440), DroppedOrderCost (100000 = serve every stop that can be served), MinuteCost (1), LatePenaltyPerMinute (0 = windows are hard), MaxWaitMinutes (1440), MinimumDriveTime (5).
wait_secondsNoHow long to wait for the solve inside this call (default 25).
previous_routesNoRe-optimize from existing routes: one list of stop ids (or 1-based stop numbers) per vehicle, in visiting order. The solver starts from these and improves them; new stops are fitted in.
skip_unfound_addressesNoIf some stop addresses cannot be found, plan routes for the other stops anyway and list the left-out ones (default false: the call fails and names them). Never skips the depot.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / vehicles / oneOf
      Previous value: -[
      -  {
      -    "maximum": 25,
      -    "minimum": 1,
      -    "type": "integer"
      -  },
      -  {
      -    "items": {
      -      "properties": {
      -        "capacity": {
      -          "description": "Max total demand. Omitted = unlimited.",
      -          "type": "number"
      -        },
      -        "capacity2": {
      -          "type": "number"
      -        },
      -        "capacity3": {
      -          "type": "number"
      -        },
      -        "fixed_cost": {
      -          "description": "Cost of using this vehicle at all, in driving minutes. Raise it to use fewer vehicles. Default 0.",
      -          "type": "number"
      -        },
      -        "id": {
      -          "description": "Name, e.g. 'Van 1'.",
      -          "type": "string"
      -        },
      -        "max_route_minutes": {
      -          "description": "Longest route, depot to depot, waiting included.",
      -          "type": "number"
      -        },
      -        "service_factor": {
      -          "description": "Service time multiplier. Default 1.",
      -          "type": "number"
      -        },
      -        "speed_factor": {
      -          "description": "Driving time multiplier: 1.2 = 20% slower. Default 1.",
      -          "type": "number"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "maxItems": 25,
      -    "minItems": 1,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "maximum": 25,
      +    "minimum": 1,
      +    "type": "integer"
      +  },
      +  {
      +    "items": {
      +      "properties": {
      +        "capacity": {
      +          "description": "Max total demand. Omitted = unlimited.",
      +          "type": "number"
      +        },
      +        "capacity2": {
      +          "type": "number"
      +        },
      +        "capacity3": {
      +          "type": "number"
      +        },
      +        "driver": {
      +          "description": "Optional driver's name, e.g. 'Ana'. Echoed on the route and shown on its driver page.",
      +          "type": "string"
      +        },
      +        "fixed_cost": {
      +          "description": "Cost of using this vehicle at all, in driving minutes. Raise it to use fewer vehicles. Default 0.",
      +          "type": "number"
      +        },
      +        "id": {
      +          "description": "Name, e.g. 'Van 1'.",
      +          "type": "string"
      +        },
      +        "max_route_minutes": {
      +          "description": "Longest route, depot to depot, waiting included.",
      +          "type": "number"
      +        },
      +        "service_factor": {
      +          "description": "Service time multiplier. Default 1.",
      +          "type": "number"
      +        },
      +        "speed_factor": {
      +          "description": "Driving time multiplier: 1.2 = 20% slower. Default 1.",
      +          "type": "number"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "maxItems": 25,
      +    "minItems": 1,
      +    "type": "array"
      +  }
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / skip_unfound_addresses
      Added value: +{
      +  "description": "If some stop addresses cannot be found, plan routes for the other stops anyway and list the left-out ones (default false: the call fails and names them). Never skips the depot.",
      +  "type": "boolean"
      +}
  3. Changed2 schema fields changed
    • changedInput schema / properties / depot / description
      Previous value: -"Where every vehicle starts and ends. Needs an address or lat+lon. If omitted, the first stop is used as the depot (reported in 'assumptions')."New value: +"REQUIRED in practice: where every vehicle starts and ends, as an OBJECT with an address or lat+lon (a plain address string is also accepted and used as the address), e.g. {\"address\": \"1 Main St, Springfield, IL 62701\"} or {\"lat\": 41.4993, \"lon\": -81.6944}. If omitted, the first stop is used as the depot (reported in 'assumptions')."
    • changedInput schema / properties / depot / type
      Previous value: -"object"New value: +[
      +  "object",
      +  "string"
      +]
  4. Changed2 schema fields changed
    • changedInput schema / properties / depot / description
      Previous value: -"Where every vehicle starts and ends. Needs an address or lat+lon."New value: +"Where every vehicle starts and ends. Needs an address or lat+lon. If omitted, the first stop is used as the depot (reported in 'assumptions')."
    • addedInput schema / properties / goal
      Added value: +{
      +  "description": "One sentence, in the user's own words, of what they are trying to do (e.g. 'plan tomorrow's deliveries for 3 vans'). Optional; helps improve the tool.",
      +  "maxLength": 300,
      +  "type": "string"
      +}
  5. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint/openWorldHint/non-destructive, and the description adds materially beyond them: expected latency (10-60 s, longer with many geocodes), the running/job_id async pattern, geocoding behavior, that driver_link stores nothing, and that every applied default is echoed in the result's 'assumptions'. It does not spell out failure modes beyond geocode misses (covered by skip_unfound_addresses) or any solver-quality caveats.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then outputs, then timing, then invocation rules, then defaults, then the example — a sensible ordering. It is dense and long for a single paragraph, and the inline JSON example plus the defaults sentence partially duplicate the schema, but no sentence is pure filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 10 parameters, nested objects, no required fields and no output schema, the description carries the full burden and does so: it covers expected results, latency, async continuation, defaults and where they are surfaced, and points to the example tool. An agent could invoke this and handle the response correctly from the description alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so this is baseline-3 territory, but the description adds genuine meaning: the default-omission semantics (capacity unlimited, no time windows, 1 vehicle, depot = first stop, stops dropped only when unservable) and a worked minimal example that demonstrates the shapes of depot, stops, windows and vehicles together.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ('Plan routes for one or more vehicles from one depot') and then enumerates the exact return payload per vehicle — stop order, arrival times, load so far, unserved stops, totals, Maps links, driver_link, warnings. Nothing about the tool's function is left ambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states the two invocation modes ('Pass either `example` or the fields below'), gives the async follow-up rule ('If the result has status "running", call get_route_result with its job_id'), and routes agents to get_route_example for realistic inputs. These are named alternatives with the conditions that select them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources