Nearest location for each customer
nearest_locationFor each of up to 50 customers, find the nearest of up to 500 locations, such as stores, warehouses or offices. Customers and locations are latitude/longitude points or addresses (looked up first). Every location is measured in a straight line; by road the 3 closest are then compared and the quickest wins, or the shortest with priority=short. vehicle=direct matches in a straight line only. Costs $0.003 per customer by road, $0.001 per customer in a straight line, plus $0.001 for each different address looked up; customers not found and failed calls are free. Locations sent as addresses are charged on every call: send the points from location_addresses next time. A customer asked by road but matched in a straight line has by_road=false and a reason (no_road, or unavailable: try again later) and costs $0.001.
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": {
"customers": "<customers>",
"locations": "<locations>"
},
"name": "nearest_location"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| units | No | Distance units: miles or kilometers. | mi |
| vehicle | No | auto (by car) or walk compare the closest by road; direct matches in a straight line only. | auto |
| priority | No | By road, the nearest is the quickest (fast) or the shortest (short). | fast |
| customers | Yes | Customers: points {latitude, longitude} or addresses as text. | |
| locations | Yes | Your locations, sent with every call: {name, latitude, longitude}, {name, address}, or an address as text. |