Back to all tools
Free / no key

Driving distance

Use after geocoding two addresses. Results are estimates from the public OSRM demo server — fine for guidance, not guaranteed SLAs.

What this tool does

Travel time and distance often decide the price of a home visit or delivery. This tool asks the public OSRM routing server for the driving route between two points and returns the distance and an estimated drive time. Use it after the geocode tool has turned both addresses into coordinates. The public server is a demo service without uptime guarantees, so treat results as guidance and keep your own pricing rules in the prompt, for example a call-out fee above a certain distance.

Example conversation

Customer

How far is your clinic from Bandra West? I want to know how long it takes.

Tool callcalculate_distance

clinic coordinates → Bandra West coordinates

AI agent

By car it is about 9 km, usually around 25 minutes outside rush hour.

Customer

Okay, and is there parking?

AI agent

Yes, there is free parking in the building basement. Would you like a morning or afternoon appointment?

Example only. Tool calls are shown so you can see when the agent uses this template. Your agent’s wording depends on your prompt and business information.

Who uses it

  • Home service businesses adding a travel fee based on driving distance.
  • Clinics and salons telling customers how long the trip will take.
  • Moving, delivery and catering companies estimating travel for a quote.

Setup

  1. Open Create agent or Edit agent and add a custom tool.
  2. Copy the fields below into the form. No API key is required.
  3. In your prompt, tell the agent to geocode both locations first, then call calculate_distance with the coordinates.

Copy into custom tool form

Copy each value into the matching field when you add a custom tool on the create or edit agent page. Replace any YOUR_… placeholders with your real credentials.

Tool name

calculate_distance

Description

Estimate driving distance and duration between two coordinates using the public OSRM router. Use after geocoding addresses when the customer asks how far something is.

Endpoint URL

Paste into Endpoint URL (https:// is added automatically).

router.project-osrm.org/route/v1/driving/{{start_lon}},{{start_lat}};{{end_lon}},{{end_lat}}

HTTP method

GET

Tool inputs (all)

1. start_lon (number) Starting point longitude 2. start_lat (number) Starting point latitude 3. end_lon (number) Ending point longitude 4. end_lat (number) Ending point latitude

Tool input: start_lon

Input name

start_lon

Input type

number

Input description

Starting point longitude

Reference value

Use this as the request query or body value and choose “Tool input” in the form.

{{start_lon}}

Tool input: start_lat

Input name

start_lat

Input type

number

Input description

Starting point latitude

Reference value

Use this as the request query or body value and choose “Tool input” in the form.

{{start_lat}}

Tool input: end_lon

Input name

end_lon

Input type

number

Input description

Ending point longitude

Reference value

Use this as the request query or body value and choose “Tool input” in the form.

{{end_lon}}

Tool input: end_lat

Input name

end_lat

Input type

number

Input description

Ending point latitude

Reference value

Use this as the request query or body value and choose “Tool input” in the form.

{{end_lat}}

Request query (all)

overview: false start_lon: {{start_lon}} start_lat: {{start_lat}} end_lon: {{end_lon}} end_lat: {{end_lat}}

Field name

overview

Field value

false

Field name

start_lon

Field value

{{start_lon}}

Field name

start_lat

Field value

{{start_lat}}

Field name

end_lon

Field value

{{end_lon}}

Field name

end_lat

Field value

{{end_lat}}