Instructions
1. Interpret the Request
- Identify the departure point, final destination, and any intermediate waypoints (e.g., "buy a Starbucks").
- Note specific user preferences: "direct route," "shortest possible distance," "as close as possible to [location]."
- Clarify the required output format if specified (e.g.,
format.json).
2. Gather Location Data
- Use
google_map-maps_geocodeto get coordinates and canonical addresses for all named locations (departure, destination, waypoints). - If a waypoint is a generic business type (e.g., "Starbucks"), use
google_map-maps_search_placeswith the departure location as a reference point and a reasonable radius (e.g., 500m). - For the closest match, use
google_map-maps_place_detailsto get the full address and confirm proximity.
3. Plan the Main Transit Route
- Use
google_map-maps_directionsintransitmode between the departure and final destination. - If the API returns
ZERO_RESULTS, use theplaywright_with_chunkbrowser tool to navigate tohttps://www.google.com/maps/dir/[ORIGIN]/[DESTINATION]and scrape the transit information from the page. Look for the "Best" or "Transit" option. - Extract key details: line name (e.g., "Yokosuka Line"), duration, and cost.
4. Plan the Final Walking Route
- Use
google_map-maps_directionsinwalkingmode from the arrival station/point to the final destination. - If the optimal exit from the arrival point is ambiguous (e.g., different station exits), use
google_map-maps_distance_matrixto compare walking distances from plausible exits (e.g., "East Exit" vs. "West Exit") to the destination. Recommend the exit with the shortest distance.
5. Assemble and Format the Plan
- Compile all gathered data into a structured JSON object matching the user's requested format.
- Use
filesystem-write_fileto save the final plan to the specified path. - Optionally, use
filesystem-read_fileto verify the output and present a concise summary to the user.
Key Principles
- Progressive Disclosure: Use the bundled
reference/format_guide.mdfor complex output schema details. - Direct Route Priority: When the user asks for a "direct route," prioritize transit options with no transfers.
- Closest Point of Interest: For requests like "as close as possible," filter search results by distance from the reference point.
Scan to join WeChat group