Description
When using maps_directions with mode: transit, the response includes the transit leg but only as a generic navigation instruction (e.g. "Bus towards Sean Moore Rd"). It does not return transit metadata such as the bus/route number, scheduled departure/arrival times, stop names, stop count, headsign, or transit agency info.
The root cause is that the field mask in src/services/RoutesService.ts does not include routes.legs.steps.transitDetails. The Google Routes API only returns transit metadata when this field is explicitly requested via the X-Goog-FieldMask header.
Steps to reproduce
- Configure the MCP server with a valid Google Maps API key that has Routes API enabled
- Use the maps_directions tool with any origin/destination pair and set mode: "transit" (e.g. origin: "Harold's Cross, Dublin", destination: "Rathmines, Dublin", mode: "transit")
- Inspect the response: walking steps have full detail, but transit steps only contain a navigationInstruction.instructions string (e.g. "Bus towards Sean Moore Rd") with no structured transit metadata
Expected behavior
The transit step should include the full transitDetails object as documented in the Google Routes API, containing:
- stopDetails.departureStop.name / departureTime
- stopDetails.arrivalStop.name / arrivalTime
- transitLine.nameShort (route number, e.g. "15")
- transitLine.vehicle.type (BUS, SUBWAY, etc.)
- transitLine.agencies
- headsign
- stopCount
- localizedValues
Reference: https://developers.google.com/maps/documentation/routes/transit-route
Environment
- Package version: latest (main branch)
- Node.js version: v22
- MCP client: Claude Code
- OS: Linux (Amazon Linux 2)
Logs
Response for the transit step:json
{
"distanceMeters": 1735,
"staticDuration": "480s",
"startLocation": { "latLng": { "latitude": 53.318856, "longitude": -6.280032 } },
"endLocation": { "latLng": { "latitude": 53.327564, "longitude": -6.264612 } },
"navigationInstruction": { "instructions": "Bus towards Sean Moore Rd" }
}
No transitDetails field is present because it's not included in the field mask.
Suggested fix: Add routes.legs.steps.transitDetails to the field mask in RoutesService.ts when travel mode is TRANSIT.
Description
When using maps_directions with mode: transit, the response includes the transit leg but only as a generic navigation instruction (e.g. "Bus towards Sean Moore Rd"). It does not return transit metadata such as the bus/route number, scheduled departure/arrival times, stop names, stop count, headsign, or transit agency info.
The root cause is that the field mask in src/services/RoutesService.ts does not include routes.legs.steps.transitDetails. The Google Routes API only returns transit metadata when this field is explicitly requested via the X-Goog-FieldMask header.
Steps to reproduce
Expected behavior
The transit step should include the full transitDetails object as documented in the Google Routes API, containing:
Reference: https://developers.google.com/maps/documentation/routes/transit-route
Environment
Logs
Response for the transit step:json
{
"distanceMeters": 1735,
"staticDuration": "480s",
"startLocation": { "latLng": { "latitude": 53.318856, "longitude": -6.280032 } },
"endLocation": { "latLng": { "latitude": 53.327564, "longitude": -6.264612 } },
"navigationInstruction": { "instructions": "Bus towards Sean Moore Rd" }
}
No transitDetails field is present because it's not included in the field mask.
Suggested fix: Add routes.legs.steps.transitDetails to the field mask in RoutesService.ts when travel mode is TRANSIT.