Skip to main content
Glama

calculate_route

Read-onlyIdempotent

Calculate real-world travel distance, duration, and route geometry between two points or place names, including optional waypoints and alternatives for driving, walking, or cycling.

Instructions

Calculate real-world travel distance, duration, turn-by-turn summary (with maneuver coordinates), GeoJSON route geometry, and route bounding box between two locations or coordinate pairs using OpenStreetMap routing (FOSSGIS / OSRM, or configurable OSRM_API_URL). Supports optional intermediate 'waypoints' and requesting 'alternatives' (up to 3 OSRM routes for side-by-side comparison with check_traffic_controls).

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": {
      "origin": "<origin>",
      "destination": "<destination>"
    },
    "name": "calculate_route"
  }
}

Input Schema

NameRequiredDescriptionDefault
originYesStarting point as 'lat,lng' coordinates (e.g. '40.7128,-74.0060') or a natural-language place name (e.g. 'Times Square, NYC').
profileNoTravel mode profile: 'driving' (car), 'walking' (foot), or 'cycling' (bicycle). Defaults to 'driving'.
waypointsNoOptional list of intermediate via-points ('lat,lng' or place names, up to 20) to force the route through specific streets or intersections.
destinationYesEnding point as 'lat,lng' coordinates (e.g. '40.6413,-73.7781') or a natural-language place name (e.g. 'JFK Airport').
alternativesNoIf true, requests up to 3 alternative routes from OSRM (only supported when 'waypoints' is empty). Defaults to false.
return_stepsNoIf true, includes step-by-step road names, maneuver instructions, and turn coordinates. Defaults to false.

Output Schema

NameRequiredDescriptionDefault
stepsNo
originYes
profileYes
completeYes
warningsYes
share_urlYes
waypointsNo
provenanceYes
route_bboxYes
destinationYes
distance_kmYes
alternativesNo
detour_factorYes
route_geometryYes
distance_metersYes
initial_bearingYes
duration_minutesYes
duration_secondsYes
alternatives_countNo
straight_line_metersYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.7.0
    • addedInput schema / properties / alternatives
      Added value: +{
      +  "description": "If true, requests up to 3 alternative routes from OSRM (only supported when 'waypoints' is empty). Defaults to false.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / return_steps / description
      Previous value: -"If true, includes step-by-step road names and maneuver instructions. Defaults to false."New value: +"If true, includes step-by-step road names, maneuver instructions, and turn coordinates. Defaults to false."
    • addedInput schema / properties / waypoints
      Added value: +{
      +  "description": "Optional list of intermediate via-points ('lat,lng' or place names, up to 20) to force the route through specific streets or intersections.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / alternatives
      Added value: +{
      +  "items": {
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / alternatives_count
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / waypoints
      Added value: +{
      +  "items": {
      +    "properties": {
      +      "label": {
      +        "type": "string"
      +      },
      +      "lat": {
      +        "type": "number"
      +      },
      +      "lng": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "lat",
      +      "lng",
      +      "label"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. Addedv1.5.0

TDQS

A3.9/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, and openWorld, so the safety profile is covered. The description adds useful external context — the routing backend (FOSSGIS/OSRM, configurable via OSRM_API_URL) and the up-to-3 alternatives cap — though the alternatives/waypoints interaction is also stated in the schema, so added value beyond structured data is moderate.

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-loads the capability list before qualifying details, and every clause carries information. It is dense as a single long sentence with stacked parentheticals, which slightly hurts scanability.

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

Completeness4/5

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

Covers inputs, provider, constraints, and even return contents for a 6-parameter tool; since an output schema exists, the return-value enumeration is somewhat redundant but not harmful. Nothing essential an agent needs to invoke it correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents origin/destination formats, profile enum with default, waypoint limit of 20, and the alternatives constraint. The description mostly restates those facts rather than adding new semantic detail (e.g., how place-name geocoding failures are reported). Baseline 3 applies.

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?

States a specific verb (calculate) and enumerates the concrete resource outputs: distance, duration, turn-by-turn summary with maneuver coordinates, GeoJSON geometry, and bounding box, plus the underlying routing provider (OSM/FOSSGIS/OSRM). An agent can distinguish this from siblings like spatial_calc or get_bounds without opening the schema.

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?

Gives clear context for the two option flags: waypoints to force the route through specific streets, and alternatives for side-by-side comparison with check_traffic_controls. It does not state exclusions (e.g., when to prefer spatial_calc or search_places for pure distance math), so it falls short of explicit when-not guidance.

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