feat: use MCP sampling to classify grounding strategy#173
Open
mattpodwysocki wants to merge 1 commit intofeat/ground-location-toolfrom
Open
feat: use MCP sampling to classify grounding strategy#173mattpodwysocki wants to merge 1 commit intofeat/ground-location-toolfrom
mattpodwysocki wants to merge 1 commit intofeat/ground-location-toolfrom
Conversation
…ion_tool 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>
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
Enhances
ground_location_toolwith MCP sampling to intelligently classify what kind of location grounding a query needs before making any Mapbox API calls.Grounding strategies
neighborhoodroutingpoiregionHow it works
When the client supports
sampling, the tool sends a short classification prompt to the LLM asking it to pick one of the four strategies. The response shapes which Mapbox APIs are called and what parameters are used — e.g. routing getstypes=address,poifor precise routable coordinates, while poi boosts the result limit to at least 15.Graceful degradation: Falls back to
neighborhood(current behavior) if:samplingcapabilityNo changes to the tool's public interface, schema, or registry wiring.
Test plan
npm testpassesnpm run buildsucceeds🤖 Generated with Claude Code