Repository navigation
fix: directions_tool turn-by-turn instructions never populated - #256
Merged
Merged
Conversation
The tool has always requested steps=true and documented its response as including "turn-by-turn instructions", but the extraction read step.voiceInstructions, which the Directions API only returns when the separate voice_instructions=true parameter is set -- never sent by this tool. So `instructions` was silently empty for every call. Switched to step.maneuver.instruction, a human-readable instruction string already present on every step whenever steps=true is set, no extra parameter needed. Raised the output cap from 10 to 200: the old cap was sized for the old source (which could emit several announcements per turn), while maneuver.instruction is one entry per real turn, so a normal route -- even a long one with dozens of turns -- stays well under it. Confirmed live against the real Directions API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mattpodwysocki
force-pushed
the
fix/directions-turn-by-turn-instructions
branch
from
October 1, 2026 14:51
e63176d to
9018d4f
Compare
…y-turn-instructions # Conflicts: # test/tools/directions-tool/cleanResponseData.test.ts
ctufts
reviewed
Oct 27, 2026
Comment on lines
+287
to
+293
| // Process steps if they exist to collect turn-by-turn instructions. | ||
| // `maneuver.instruction` (e.g. "Bear right onto Great Portland | ||
| // Street/A4201") is present on every step whenever steps=true is | ||
| // requested, unlike `step.voiceInstructions`, which requires the | ||
| // separate voice_instructions=true parameter -- never sent by this | ||
| // tool, so that field was always empty and `instructions` never | ||
| // actually populated. |
Contributor
There was a problem hiding this comment.
NIT: this seems like a comment documenting history, not functionality
Contributor
Author
There was a problem hiding this comment.
Fair, rewrote it to describe what the code does (4b20de5).
ctufts
reviewed
Oct 27, 2026
Comment on lines
+317
to
+322
| // One instruction per real maneuver (unlike the old voice-announcement | ||
| // source, which could repeat several announcements per turn), so a | ||
| // normal route -- even a long one with dozens of turns -- stays well | ||
| // within a generous cap. The cap here is just a backstop against a | ||
| // pathological case (e.g. many waypoints each with a complex urban leg), | ||
| // not a limit expected to bite in practice. |
From review on #256. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ctufts
approved these changes
Oct 28, 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
directions_toolhas always requestedsteps=trueand says it returns turn-by-turn instructions, butinstructionshas been empty on every call.Cause: the code read
step.voiceInstructions, which the Directions API only fills in whenvoice_instructions=trueis sent. We never send it.Fix:
step.maneuver.instructioninstead, a readable sentence on every step wheneversteps=true(for example"Turn right onto 10th Street."). No extra API parameter.maneuver.instructionis one per turn, so even a long route with dozens of turns fits, and a cap of 10 would have cut off almost every real route.Spun out of review on #255.
Updated after #296 and #298 merged
Main was merged in. The only conflict was in
cleanResponseData.test.ts: this PR's new expectations against main's typedroutesOf()helper, so the tests now use that helper and pass the CI typecheck. The CHANGELOG entry moved under Unreleased with its PR number.Testing
cleanResponseData.test.tscovers the real step shape, a step with no instruction, a 40-turn route and the 200 cap."Drive northeast on Market Street.","Turn right onto 10th Street.", ...) where it returned none before.🤖 Generated with Claude Code