Skip to main content
Glama

Calculate Route

calculate_route

Sequences stops (e.g. home, depot, calls, home): returns order, road distance, drive time, per-leg timings, and geometry from TomTom or Azure Maps, and draws the path on the open map (map_session_id). Creates no territory and changes no assignment. route_type: circuit (returns to start), tour (ends at required end stop), or open_tour (one way). stop_sets run in array order with no cross-set moves; order is optimize or as_given; group_by_field adds priority bands. Stops are inline coordinates or point-layer refs (e.g. source.filter.territory_id); point_ids and stop_id are point_id values (visits: <account_id>#). A new route_id adds a second route; recalculating an existing route_id replaces it, e.g. to drop a stop. dwell_time is stored for analyze_routes and publish_appointments_to_dataverse (appointment length and spacing). Route drive time is not territory workload. No key: ROUTING_NOT_CONFIGURED; past annual quota: PROVIDER_QUOTA_EXCEEDED. Returns a task.

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": {
      "start": "<start>",
      "stop_sets": "<stop_sets>"
    },
    "name": "calculate_route"
  }
}

Input Schema

NameRequiredDescriptionDefault
endNoDestination. Required for route_type=tour, rejected otherwise.
startYesOrigin. Must resolve to exactly one stop.
route_idNoStable identity for the route inside the solution. A new route_id adds a route alongside the existing ones; reusing a route_id replaces that route in place. To add or drop a stop, call again with the SAME route_id and the revised stop list — there is no add-stop tool and delete_route is for dropping the whole route. Defaults to a slug of route_label, else a generated id.
depart_atNoRFC 3339 departure time. Drives traffic-aware durations. Defaults to now.
stop_setsYes
ts_handleNoTerritory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline.
dwell_timeNo
route_typeNocircuit returns to start; tour finishes at the declared end (required); open_tour lets the optimizer choose the final stop and never returns to start.
route_labelNoDisplay name for the route on the map and in the legend. Seeds route_id when route_id is omitted.
travel_modeNocar
map_session_idNoOpen map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set.
include_geometryNoSet false to skip the route polyline when only sequence and timings are needed.

Output Schema

NameRequiredDescriptionDefault
okYes
errorNoPresent when ok is false.
resultNoPresent when ok is true.
warningsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / route_type / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / route_type / default
      Added value: +null
    • removedInput schema / properties / route_type / type
      Removed value: -"string"
    • changedInput schema / required
      Previous value: -[
      -  "route_type",
      -  "start",
      -  "stop_sets"
      -]New value: +[
      +  "start",
      +  "stop_sets"
      +]
  2. Changed23 schema fields changed
    • addedInput schema / $defs
      Added value: +{
      +  "RepoShape1": {
      +    "description": "Several inline stops in one source.",
      +    "items": {
      +      "$ref": "#/$defs/RepoShape3"
      +    },
      +    "type": "array"
      +  },
      +  "RepoShape2": {
      +    "additionalProperties": true,
      +    "description": "Property equality filter applied to the point layer, e.g. {\"territory_id\": \"<leaf id>\"} after auto_build or {\"bucket_id\": \"d01-b1\"} on <point_layer>_visits after schedule_visits (which also stamps schedule_day, schedule_date, and contractor_id). A display label such as T1 does not match. A list value matches any member.",
      +    "type": "object"
      +  },
      +  "RepoShape3": {
      +    "additionalProperties": true,
      +    "properties": {
      +      "label": {
      +        "type": "string"
      +      },
      +      "latitude": {
      +        "maximum": 90,
      +        "minimum": -90,
      +        "type": "number"
      +      },
      +      "longitude": {
      +        "maximum": 180,
      +        "minimum": -180,
      +        "type": "number"
      +      },
      +      "properties": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "stop_id": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "latitude",
      +      "longitude"
      +    ],
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / depart_at / description
      Added value: +"RFC 3339 departure time. Drives traffic-aware durations. Defaults to now."
    • changedInput schema / properties / end / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "properties": {
      +      "filter": {
      +        "$ref": "#/$defs/RepoShape2"
      +      },
      +      "label": {
      +        "type": "string"
      +      },
      +      "label_field": {
      +        "description": "Point property to use as the stop label on the map.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "latitude": {
      +        "maximum": 90,
      +        "minimum": -90,
      +        "type": "number"
      +      },
      +      "longitude": {
      +        "maximum": 180,
      +        "minimum": -180,
      +        "type": "number"
      +      },
      +      "point_ids": {
      +        "description": "Specific point_id values from point_layer (a <point_layer>_visits layer uses <account_id>#<visit_index>). An id that is not a point_id selects every point with that account_id. For an as_given set, this array is also the visit order.",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "point_layer": {
      +        "description": "Ingested point layer to draw stops from. Resolved against ts / ts_handle / map_session_id.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "stop_id": {
      +        "description": "Id for an inline stop. Point-layer stops always use the point's point_id, so a route pushed to Designer links to the same point.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "stops": {
      +        "$ref": "#/$defs/RepoShape1"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / end / description
      Added value: +"Destination. Required for route_type=tour, rejected otherwise."
    • removedInput schema / properties / end / title
      Removed value: -"End"
    • addedInput schema / properties / include_geometry / description
      Added value: +"Set false to skip the route polyline when only sequence and timings are needed."
    • addedInput schema / properties / map_session_id / description
      Added value: +"Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set."
    • addedInput schema / properties / route_id / description
      Added value: +"Stable identity for the route inside the solution. A new route_id adds a route alongside the existing ones; reusing a route_id replaces that route in place. To add or drop a stop, call again with the SAME route_id and the revised stop list — there is no add-stop tool and delete_route is for dropping the whole route. Defaults to a slug of route_label, else a generated id."
    • addedInput schema / properties / route_label / description
      Added value: +"Display name for the route on the map and in the legend. Seeds route_id when route_id is omitted."
    • addedInput schema / properties / route_type / description
      Added value: +"circuit returns to start; tour finishes at the declared end (required); open_tour lets the optimizer choose the final stop and never returns to start."
    • addedInput schema / properties / start / description
      Added value: +"Origin. Must resolve to exactly one stop."
    • addedInput schema / properties / start / properties
      Added value: +{
      +  "filter": {
      +    "$ref": "#/$defs/RepoShape2"
      +  },
      +  "label": {
      +    "type": "string"
      +  },
      +  "label_field": {
      +    "description": "Point property to use as the stop label on the map.",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "latitude": {
      +    "maximum": 90,
      +    "minimum": -90,
      +    "type": "number"
      +  },
      +  "longitude": {
      +    "maximum": 180,
      +    "minimum": -180,
      +    "type": "number"
      +  },
      +  "point_ids": {
      +    "description": "Specific point_id values from point_layer (a <point_layer>_visits layer uses <account_id>#<visit_index>). An id that is not a point_id selects every point with that account_id. For an as_given set, this array is also the visit order.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "point_layer": {
      +    "description": "Ingested point layer to draw stops from. Resolved against ts / ts_handle / map_session_id.",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "stop_id": {
      +    "description": "Id for an inline stop. Point-layer stops always use the point's point_id, so a route pushed to Designer links to the same point.",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "stops": {
      +    "$ref": "#/$defs/RepoShape1"
      +  }
      +}
    • removedInput schema / properties / start / title
      Removed value: -"Start"
    • changedInput schema / properties / stop_sets / items / additionalProperties
      Previous value: -trueNew value: +false
    • addedInput schema / properties / stop_sets / items / description
      Added value: +"One group of stops. Sets are visited in array order and optimization never moves a stop across a set boundary."
    • addedInput schema / properties / stop_sets / items / properties
      Added value: +{
      +  "group_by_field": {
      +    "description": "Point property that splits the set into ordered bands, e.g. route_priority. Every band-1 stop precedes every band-2 stop, and stops are optimized within a band.",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "group_direction": {
      +    "default": "asc",
      +    "enum": [
      +      "asc",
      +      "desc"
      +    ],
      +    "type": "string"
      +  },
      +  "order": {
      +    "default": "optimize",
      +    "description": "as_given keeps the declared order; optimize sequences the set to reduce travel.",
      +    "enum": [
      +      "as_given",
      +      "optimize"
      +    ],
      +    "type": "string"
      +  },
      +  "set_id": {
      +    "description": "Identifier echoed on each stop in the result. Defaults to set-1, set-2, ...",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "source": {
      +    "additionalProperties": true,
      +    "description": "Either inline coordinates or a reference to points already in the territory solution.",
      +    "properties": {
      +      "filter": {
      +        "$ref": "#/$defs/RepoShape2"
      +      },
      +      "label": {
      +        "type": "string"
      +      },
      +      "label_field": {
      +        "description": "Point property to use as the stop label on the map.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "latitude": {
      +        "maximum": 90,
      +        "minimum": -90,
      +        "type": "number"
      +      },
      +      "longitude": {
      +        "maximum": 180,
      +        "minimum": -180,
      +        "type": "number"
      +      },
      +      "point_ids": {
      +        "description": "Specific point_id values from point_layer (a <point_layer>_visits layer uses <account_id>#<visit_index>). An id that is not a point_id selects every point with that account_id. For an as_given set, this array is also the visit order.",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "point_layer": {
      +        "description": "Ingested point layer to draw stops from. Resolved against ts / ts_handle / map_session_id.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "stop_id": {
      +        "description": "Id for an inline stop. Point-layer stops always use the point's point_id, so a route pushed to Designer links to the same point.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "stops": {
      +        "$ref": "#/$defs/RepoShape1"
      +      }
      +    },
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / stop_sets / minItems
      Added value: +1
    • removedInput schema / properties / stop_sets / title
      Removed value: -"Stop Sets"
    • addedInput schema / properties / ts_handle / description
      Added value: +"Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline."
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / properties
      Added value: +{
      +  "error": {
      +    "description": "Present when ok is false.",
      +    "properties": {
      +      "ask_user": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "code": {
      +        "type": "string"
      +      },
      +      "details": {
      +        "type": "object"
      +      },
      +      "do_this_next": {
      +        "type": "object"
      +      },
      +      "message": {
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "ok": {
      +    "type": "boolean"
      +  },
      +  "result": {
      +    "description": "Present when ok is true.",
      +    "properties": {
      +      "created_at": {
      +        "type": "string"
      +      },
      +      "do_this_next": {
      +        "type": "object"
      +      },
      +      "estimated_remaining_ms": {
      +        "type": "integer"
      +      },
      +      "estimated_start_ms": {
      +        "type": "integer"
      +      },
      +      "expires_at": {
      +        "type": "string"
      +      },
      +      "job_id": {
      +        "type": "string"
      +      },
      +      "next_action": {
      +        "type": "string"
      +      },
      +      "next_poll_at": {
      +        "type": "string"
      +      },
      +      "phase": {
      +        "type": "string"
      +      },
      +      "poll_interval_ms": {
      +        "type": "integer"
      +      },
      +      "poll_loop": {
      +        "type": "object"
      +      },
      +      "progress": {
      +        "type": "number"
      +      },
      +      "queue_depth": {
      +        "type": "integer"
      +      },
      +      "queue_lane": {},
      +      "queue_position": {
      +        "type": "integer"
      +      },
      +      "recommended_poll_delay_ms": {
      +        "type": "integer"
      +      },
      +      "required_input": {
      +        "type": "object"
      +      },
      +      "result_resource_uri": {
      +        "type": "string"
      +      },
      +      "sleep_ms": {
      +        "type": "integer"
      +      },
      +      "status": {
      +        "type": "string"
      +      },
      +      "status_resource_uri": {
      +        "type": "string"
      +      },
      +      "task_id": {
      +        "type": "string"
      +      },
      +      "terminal": {
      +        "type": "boolean"
      +      },
      +      "tool_name": {
      +        "type": "string"
      +      },
      +      "total": {
      +        "type": [
      +          "null",
      +          "number"
      +        ]
      +      },
      +      "user_cancelled": {
      +        "type": "boolean"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "warnings": {
      +    "items": {
      +      "properties": {
      +        "code": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "ok"
      +]
    • removedOutput schema / title
      Removed value: -"calculate_routeDictOutput"
  3. Changed1 schema field changed
    • changedInput schema / properties / dwell_time / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": true,
      +    "description": "Onsite (dwell) time per visit: {type: 'scalar', value: <number>, unit: 'minutes'|'hours'} or {type: 'field', field: '<column>', unit: 'minutes'|'hours'}.",
      +    "properties": {
      +      "field": {
      +        "description": "Point column name holding per-account onsite time when type='field'.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "type": {
      +        "description": "Dwell source: 'scalar' for a fixed per-visit duration or 'field' for an ingested point column.",
      +        "enum": [
      +          "scalar",
      +          "field"
      +        ],
      +        "type": "string"
      +      },
      +      "unit": {
      +        "default": "minutes",
      +        "description": "Time unit for value or field ('minutes' or 'hours').",
      +        "enum": [
      +          "minutes",
      +          "hours"
      +        ],
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Confirmed onsite duration per visit when type='scalar'.",
      +        "minimum": 0,
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  4. Changed1 schema field changed
    • removedInput schema / properties / guidance_handle
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Guidance Handle"
      -}
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (which already flag a non-read-only, open-world, non-destructive, non-idempotent call), the description discloses external provider dependence (TomTom or Azure Maps), side effects on the open map session (map_session_id drawing), replace-in-place behavior on route_id reuse, dwell_time persistence for later tools, and two concrete failure modes (ROUTING_NOT_CONFIGURED, PROVIDER_QUOTA_EXCEEDED). Noting it returns a task also signals asynchronous execution, which the annotations do not convey.

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?

The most important facts (what it sequences, what it returns, what it does not change) are front-loaded, and the telegraphic style packs a lot into few lines with no filler sentences. It is dense to the point of being a wall of clauses, though, and a few details (provider naming, error codes) are crammed into the same run-on block rather than separated.

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?

For a 12-parameter tool with deeply nested stop sources, an output schema, and an external routing backend, the description supplies the missing context: route_id add-vs-replace semantics, ordering behavior across sets and bands, dwell_time persistence, and the error conditions. Combined with a rich schema and output schema, an agent has enough to select and invoke it correctly.

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?

With 75% schema coverage the baseline is a 3, and the description earns above that by explaining route_type's three shapes (circuit/tour/open_tour), that stop_sets run in array order with no cross-set moves, that group_by_field creates priority bands, and that point_ids/stop_id are point_id values with a visits format of <account_id>#<n>. Some of this paraphrases schema text (route_type, group_by_field), and start/end resolution rules are left mostly to the schema, so it is not a full 5.

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?

The opening sentence states a concrete verb+resource (sequences stops into a route), enumerates exactly what comes back (order, road distance, drive time, per-leg timings, geometry) and names the routing providers. It also draws a hard boundary ('Creates no territory and changes no assignment'), which separates it from territory-building siblings and from delete_route/analyze_routes at a glance.

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

Usage Guidelines4/5

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

It gives clear when-to guidance: route_id semantics for adding a second route vs replacing an existing one (explicitly framed as the way to drop a stop), and what dwell_time is stored for downstream (analyze_routes, publish_appointments_to_dataverse). It also clarifies route drive time is not territory workload. It stops short of naming an alternative tool to call instead when the goal is territory creation or pure analysis, so it is strong but not fully explicit about alternatives.

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