Add two-stage elicitations for DirectionsTool #99
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
Implements a two-stage elicitation flow for DirectionsTool to provide better route selection UX:
Stage 1 (Routing Preferences): Ask users about their routing preferences before calling the API
Stage 2 (Route Selection): Present actual routes for user selection after API call
Implementation Details
formatDuration()andformatDistance()for readable outputalternatives=trueto get multiple routes for Stage 2Test Scenarios
These scenarios demonstrate the two-stage elicitation flow. Screenshots to be added below.
Scenario 1: Full two-stage flow (NYC to Boston)
Input:
{ "coordinates": [ {"longitude": -74.006, "latitude": 40.7128}, {"longitude": -71.0589, "latitude": 42.3601} ], "routing_profile": "mapbox/driving-traffic" }Expected behavior:
exclude=toll,cash_only_tollsScreenshot placeholders:
Scenario 2: User declines Stage 1 preferences
Input:
{ "coordinates": [ {"longitude": -118.24, "latitude": 34.05}, {"longitude": -122.42, "latitude": 37.78} ], "routing_profile": "mapbox/driving" }Expected behavior:
Screenshot placeholders:
Scenario 3: Walking profile (no highway option)
Input:
{ "coordinates": [ {"longitude": -74.006, "latitude": 40.7128}, {"longitude": -73.99, "latitude": 40.73} ], "routing_profile": "mapbox/walking" }Expected behavior:
Screenshot placeholders:
Scenario 4: Multi-waypoint route (no elicitation)
Input:
{ "coordinates": [ {"longitude": -74.006, "latitude": 40.7128}, {"longitude": -73.9, "latitude": 41.0}, {"longitude": -71.0589, "latitude": 42.3601} ] }Expected behavior:
Scenario 5: Exclude parameter already provided (no Stage 1)
Input:
{ "coordinates": [ {"longitude": -74.006, "latitude": 40.7128}, {"longitude": -71.0589, "latitude": 42.3601} ], "exclude": "motorway" }Expected behavior:
Testing
Notes