Skip to main content
Glama

Nearest location for each customer

nearest_location
Read-onlyIdempotent

For 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

NameRequiredDescriptionDefault
unitsNoDistance units: miles or kilometers.mi
vehicleNoauto (by car) or walk compare the closest by road; direct matches in a straight line only.auto
priorityNoBy road, the nearest is the quickest (fast) or the shortest (short).fast
customersYesCustomers: points {latitude, longitude} or addresses as text.
locationsYesYour locations, sent with every call: {name, latitude, longitude}, {name, address}, or an address as text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover read-only, idempotent, open-world and non-destructive status, and the description goes well beyond that: it discloses the full pricing model per customer and per address lookup, what is free (not-found customers, failed calls), the road-vs-straight-line fallback, and the by_road=false plus reason (no_road, unavailable) outcome. This is exactly the billing and failure context annotations cannot express.

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 core capability and its limits are front-loaded in the first sentence, followed by matching logic, then cost. The final sentence is a long run-on covering fallback, reason codes and pricing, which costs some readability, but nearly every clause carries information an agent needs.

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?

No output schema exists, yet the description identifies the key result fields (by_road, reason) and the meaning of the location name field, and it fully covers cost and failure behavior for a fairly complex matching tool. The overall response shape beyond those named fields is not spelled out, which is the only remaining gap.

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 100%, so the baseline is 3, but the description adds algorithmic meaning the schema does not: by road the three closest candidates are compared and the quickest wins, or the shortest with priority=short, and vehicle=direct restricts to straight-line matching. The per-customer/per-location cost implications of choosing addresses over points also add decision-relevant weight to the parameter choices.

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 and resource with explicit cardinality bounds: 'For each of up to 50 customers, find the nearest of up to 500 locations.' It also names the domain (stores, warehouses, offices) and the matching mode (straight line vs road), which cleanly separates it from siblings like distance, route, or geocode that handle one pair or one point.

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 operational context: vehicle=direct for straight-line-only matching, road mode for quickest/shortest comparison, and priority=short for shortest-by-road. It also steers away from resending addresses by pointing to location_addresses on subsequent calls. It stops short of naming a sibling to use instead for single-pair or one-off distance queries, so there is no explicit exclusion.

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