"How far is it from New York to London?" Your agent attempts to apply the Haversine formula mentally and gets 5,470 km. The actual distance is 5,570 km. Geographic distance calculations require precise trigonometric math. These tools use the Haversine formula correctly.
All Geolocation Tools (16)
Your agent gets access to 16 geolocation tools via the /mcp/geo/ endpoint. Here's the complete list:
| Tool | Description |
|---|---|
geo/haversine | Haversine Distance |
geo/bearing | Calculate Bearing |
geo/midpoint | Calculate Midpoint |
geo/destination | Destination Point |
geo/dms-to-decimal | Dms To Decimal |
geo/decimal-to-dms | Decimal To Dms |
geo/is-valid-coordinates | Is Valid Coordinates |
geo/bounding-box | Bounding Box |
geo/point-in-polygon | Point In Polygon |
geo/geohash-encode | Geohash Encode |
geo/geohash-decode | Geohash Decode |
geo/polygon-area | Polygon Area |
geo/polyline-length | Polyline Length |
geo/centroid | Polygon Centroid |
geo/timezone-offset | Timezone Offset |
geo/sun-position | Sun Position |
Agent Scenarios
Here's how real agents use these tools:
1. Delivery routing agent
A logistics agent calculates the distance between a warehouse and delivery address for shipping estimates.
geo/distance
{ "lat1": 40.7128, "lon1": -74.006, "lat2": 34.0522, "lon2": -118.2437 }
2. Store locator agent
A retail agent finds the nearest store by calculating distances from a customer's location to all store coordinates.
geo/distance
{ "lat1": 51.5074, "lon1": -0.1278, "lat2": 48.8566, "lon2": 2.3522 }
MCP Setup
Add geolocation tools to your agent in under 2 minutes. Choose your client:
Claude Desktop / Claude Code
Add this to your MCP config:
{
"mcpServers": {
"tinyfn-geo": {
"url": "https://api.tinyfn.io/mcp/geo/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
Cursor
Go to Settings > MCP and add a new server:
- Type: SSE
- URL:
https://api.tinyfn.io/mcp/geo/sse - Headers:
X-API-Key: your-api-key
Tip: Use the category-specific endpoint (/mcp/geo/) for the best experience. The all-in-one endpoint (/mcp/all/) works too but has 500+ tools which some clients handle less efficiently.
When to Use These Tools
Use geolocation MCP tools when your agent needs to:
- Guarantee correctness — when wrong answers have real consequences
- Process user data — when you're operating on actual user input, not hypothetical examples
- Maintain consistency — when the same input must always produce the same output
You don't need these tools for casual conversation or rough estimates. Use them when precision matters.
Ready to add geolocation tools to your agent?
Get Free API Key 100 requests/month free. No credit card required.Frequently Asked Questions
What formula does TinyFn use for distance?
TinyFn uses the Haversine formula, which calculates great-circle distances between two points on a sphere. This provides accuracy to within 0.5% for Earth distances.
What units are distances returned in?
Distances are returned in both kilometers and miles. You can specify your preferred unit in the request.
Can TinyFn calculate midpoints?
Yes. TinyFn can calculate the geographic midpoint between two coordinates, useful for finding central meeting points or map centering.