Add 9 offline geospatial tools using Turf.js #96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds 9 fundamental geospatial calculation tools that work completely offline without requiring Mapbox API calls. These tools provide AI agents with essential spatial reasoning capabilities.
New Tools
All tools use Turf.js for accurate geospatial calculations:
distance_tool - Calculate distance between coordinates using Haversine formula
point_in_polygon_tool - Test if a point is inside a polygon
bearing_tool - Calculate compass direction between coordinates
midpoint_tool - Find geographic midpoint along great circle path
centroid_tool - Calculate center point of polygons/multipolygons
area_tool - Calculate polygon area
bbox_tool - Calculate bounding box of any geometry
buffer_tool - Create buffer zones around geometries
simplify_tool - Reduce vertex count using Douglas-Peucker algorithm
Implementation Details
BaseTool(not MapboxApiBasedTool) for offline operationopenWorldHint: falseto indicate no external API calls{longitude, latitude}instead of tuples to avoid JSON schema issuesSDK Update
Also updates
@modelcontextprotocol/sdkfrom 1.25.1 → 1.25.2 to fix CVE. Updated patch file removes icons support (that belongs in #93) and keeps only output validation fixes.Testing
✅ All 457 tests passing
✅ Build successful
✅ Input schema validation (no z.tuple() usage)
✅ Annotations tests updated for offline tools
Example Usage
🤖 Generated with Claude Code