Skip to content

maps_directions: Transit mode missing bus/route details (transitDetails not in field mask) #78

@abhijeet-reddy

Description

@abhijeet-reddy

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

  1. Configure the MCP server with a valid Google Maps API key that has Routes API enabled
  2. 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")
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions