feat: ground_location_tool MCP sampling + grounding strategy fixes#187
Open
mattpodwysocki wants to merge 10 commits into
Open
feat: ground_location_tool MCP sampling + grounding strategy fixes#187mattpodwysocki wants to merge 10 commits into
mattpodwysocki wants to merge 10 commits into
Conversation
Composes reverse geocoding, category search, and isochrone into a single tool that grounds AI responses in live Mapbox data rather than training data. Returns place name, nearby POIs, and travel-time reachability with explicit citations. Closes #165 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ual tools
Use directive language ("Use this as the FIRST tool", "Prefer this over calling
reverse_geocode_tool + category_search_tool + isochrone_tool separately") so the
model selects this composite tool instead of individual tools for location context
questions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add "FIRST and ONLY", explicit "do NOT also call reverse_geocode_tool or search the web for places", and explain the query parameter usage inline so the model passes the place category (restaurant, coffee, etc.) through our tool instead of making a separate web/Google Places search. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…xt queries When the user needs neighborhood context or nearby places, reverse_geocode_tool description now explicitly redirects to ground_location_tool, which already includes reverse geocoding. Prevents redundant tool calls. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…name Add types=neighborhood,locality,place to the reverse geocode call so ground_location_tool returns "The Loop" rather than "2454 Oakton St" for the place name — matching what the user expects for neighborhood context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Addresses reviewer feedback — profile enum values must match the Mapbox Isochrone API format (mapbox/walking, mapbox/driving, etc.) and mapbox/driving-traffic was missing as an option. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion_tool (#173) When the client supports sampling, ground_location_tool asks the LLM to classify the query intent into one of four strategies before making any Mapbox API calls: - neighborhood: reverse geocode at neighborhood/locality level + isochrone - routing: reverse geocode at address/poi level for precise routable coords - poi: category search with boosted limit (min 15), no isochrone - region: reverse geocode at region/district level + isochrone Falls back gracefully to 'neighborhood' if sampling is not supported, returns an unexpected classification, or throws an error — so existing clients are unaffected. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…tool # Conflicts: # src/tools/ground-location-tool/GroundLocationTool.ts # src/tools/index.ts
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Valiunia
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Brings the follow-up improvements to
ground_location_tool(originally merged in #166) forward to main. The bulk of the work landed as #173, but it was merged into the feature branch — this PR gets it to main along with several smaller fixes that accumulated on the same branch.What's included
routing/neighborhood/poi/region) and shapes the downstream Geocoding, Search, and Isochrone calls accordingly. Falls back toneighborhoodwhen the client doesn't support sampling, so behavior is unchanged for clients without sampling capability.mapbox/prefix consistently and adddriving-trafficsupport.routingreturnsaddress,poi).ground_location_tooloverreverse_geocode_toolfor location-context queries, and to pass the user's query as a parameter rather than calling other tools in parallel.Test plan
npm test)npx vitest run test/tools/ground-location-tool/)npm run build)Unreleased🤖 Generated with Claude Code