Directions Template Response Skill
Core Objective
Extract structured parameters to populate the DirectionsExtractorSchema for
rendering directions on a map.
Multi-Step Route Resolution Policy
If the user's query requests a scenic bypass or detour:
- Resolve Place Coordinates and IDs (Parallel Search): Concurrently search
for the origin, destination, and any identified detour waypoints along the
corridor.
- Compute Route Segments (Parallel Routing): Concurrently compute routes
for all sequential legs connecting the resolved stops (Origin -> Waypoint,
Waypoint -> Destination).
- Dispatch Response: Call
set_model_response with the compiled routes
and pins.
Step-by-Step Workflow
Analyze the Query & Constraints:
- Identify the origin and destination names.
- Identify the Requested Travel Mode (MANDATORY): Extract the explicit
travel mode from the user's query:
driving: car, drive, driving, auto, or default if travel mode cannot be inferred.
walking: walk, walking, on foot, pedestrian, foot.
bicycling: bike, biking, bicycle, bicycling, cycling.
transit: bus, train, subway, metro, tube, public transit.
Resolve Place Coordinates and IDs (Parallel Search):
- Issue ALL
search_places calls concurrently for the origin,
destination, and all intermediate waypoints or scenic stops along the
corridor.
- IDENTIFY SCENIC DETOURS & WAYPOINTS:
- If the user asks to "avoid [City X]" or take a "scenic
bypass/detour", use your knowledge to identify 2-3 major scenic
towns, highway junctions, or landmarks along the alternative bypass
corridor (e.g., "Jemez Springs" to avoid Santa Fe between
Albuquerque and Los Alamos, or "Winters, CA" and "Anderson Valley,
CA" to take backroads between Sacramento and Mendocino).
- Concurrently search for these detour waypoints along with the origin
and destination.
- STABLE SEARCH QUERIES: Use specific place or town names (e.g.,
search for "Anderson Valley, CA" or "Jemez Springs, NM") instead of
generic road descriptors (e.g. do not search for "Highway 128 scenic
route"), as generic queries are unstable and often return empty
results (
{}).
- Do NOT execute independent tool calls sequentially across multiple
turns.
- Construct sequential route segments connecting the resolved detour
waypoints in order: Origin -> Waypoint 1 -> Waypoint 2 -> Destination.
Compute Routes and Dispatch Response (Parallel Routing):
- Issue
compute_routes calls concurrently for all route segment pairs.
- STRICT TOOL PARAMETERS: When calling
compute_routes, ensure that
origin and destination objects conform to the maps tool contract.
Specify exactly one identifier:
placeId: Use the resolved place ID (e.g., {"placeId": "ChIJ-ZeD..."}). This is highly preferred if available.
address: Use the address string.
location: Use latitude/longitude inside a location sub-object
(e.g., {"location": {"latLng": {"latitude": 37.7, "longitude": -122.4}}}). Do NOT pass latLng directly as a root key inside
origin or destination (e.g. do not call
compute_routes(origin={"placeId": "...", "latLng": ...})).
- Verify route availability for requested
travel_mode.
- CONSTRUCT THE ROUTES ARRAY: You MUST compile the computed segments
into the
routes array of the final set_model_response payload. The
array must contain all segments sequentially (e.g. [{"origin": Origin, "destination": Waypoint 1}, {"origin": Waypoint 1, "destination": Destination}]). Do NOT omit the routes array or leave it empty if you
successfully computed routes.
- MANDATORY TRAVEL MODE IN DISPATCH:
travel_mode is REQUIRED and
must NEVER be omitted in set_model_response. Always supply the
normalized mode string (driving, walking, transit, or bicycling).
- Call
set_model_response with DirectionsExtractorSchema parameters
(summary, center_lat, center_lng, zoom, routes,
travel_mode).
Handling Routing Failures & Regional Limitations (CRITICAL)
Google Maps routing (driving, walking) is not supported in certain regions (such
as South Korea). If a tool call to compute_routes returns empty results ({})
or fails:
- Do NOT retry with alternative queries or locations.
- Immediately exit the tool-calling loop.
- Return a user-friendly summary explaining the regional limitation (e.g.
"Google Maps directions are not supported in South Korea"), and set the
routes list to empty
[].
Output Fields
You MUST populate all required fields in the output schema:
summary: A detailed response summarizing the travel directions, following the Conversational Text Style Guidelines below.
center_lat: Latitude of the center of the route map.
center_lng: Longitude of the center of the route map.
zoom: Recommended map zoom level. Default to 12.
routes: A list of route segments connecting the origin, intermediate
waypoints, and the destination in order.
travel_mode: (REQUIRED) The transit travel mode (driving, walking, transit, bicycling). Must match the user's requested travel mode and must never be omitted.
Examples
Example 1: Driving Route
User Query: "Directions from San Francisco to San Jose by car"
Tool Call:
set_model_response(summary="Driving from San Francisco to San Jose takes about 50 minutes via US-101 S.", center_lat=37.55, center_lng=-122.15, zoom=10, routes=[{"origin": {"lat": 37.7749, "lng": -122.4194, "label": "San Francisco", "placeId": "ChIJIQBpAG2ahYAR_6128GcTUEo"}, "destination": {"lat": 37.3382, "lng": -121.8863, "label": "San Jose", "placeId": "ChIJ9T_nxcC1j4ARmMo7S4ABIdM"}}], travel_mode="driving")
Example 2: Walking Route
User Query: "How do I walk from Central Park to Times Square?"
Tool Call:
set_model_response(summary="Walking from Central Park to Times Square takes about 18 minutes (0.9 miles) down 7th Ave.", center_lat=40.765, center_lng=-73.978, zoom=14, routes=[{"origin": {"lat": 40.768, "lng": -73.974, "label": "Central Park South", "placeId": "ChIJN1t_tDeuEmsRUsoyG83frY4"}, "destination": {"lat": 40.758, "lng": -73.985, "label": "Times Square", "placeId": "ChIJmQJItx6vwokRLxVi2JyuzRo"}}], travel_mode="walking")
Example 3: Bicycling Route
User Query: "Bike directions from Venice Beach to Santa Monica Pier"
Tool Call:
set_model_response(summary="Biking from Venice Beach to Santa Monica Pier takes around 15 minutes along the Marvin Braude Bike Trail.", center_lat=33.998, center_lng=-118.483, zoom=13, routes=[{"origin": {"lat": 33.985, "lng": -118.469, "label": "Venice Beach", "placeId": "ChIJ-wjh2I-6woARx3H-n9uVn4A"}, "destination": {"lat": 34.009, "lng": -118.497, "label": "Santa Monica Pier", "placeId": "ChIJw8g0Xbm7woARQY1Xq41qB2M"}}], travel_mode="bicycling")
Example 4: Transit Route
User Query: "Take the subway from Grand Central to Brooklyn Bridge"
Tool Call:
set_model_response(summary="Take the 4 or 5 subway line south from Grand Central - 42 St to Brooklyn Bridge - City Hall (approx. 12 minutes).", center_lat=40.731, center_lng=-73.988, zoom=12, routes=[{"origin": {"lat": 40.7527, "lng": -73.9772, "label": "Grand Central Terminal", "placeId": "ChIJ4zBEaKZQwokREuE50bbCGYs"}, "destination": {"lat": 40.7126, "lng": -74.0049, "label": "Brooklyn Bridge - City Hall", "placeId": "ChIJ40i5iRZawokRHqGfF2b_3yI"}}], travel_mode="transit")
Example 5: Unspecified Travel Mode (Defaults to Driving)
User Query: "Directions from Austin to San Antonio"
Tool Call:
set_model_response(summary="Driving from Austin to San Antonio takes about 1 hour and 20 minutes via I-35 S.", center_lat=29.85, center_lng=-98.15, zoom=9, routes=[{"origin": {"lat": 30.2672, "lng": -97.7431, "label": "Austin", "placeId": "ChIJLwW05NsQW4YRtxm00DkzqlU"}, "destination": {"lat": 29.4241, "lng": -98.4936, "label": "San Antonio", "placeId": "ChIJrw7QBK9YXIYRowalignfdg4"}}], travel_mode="driving")
1---2name: directions-template-response3description: Extractor skill for directions and routing queries. Extracts routing details for template merging.4---56# Directions Template Response Skill78## Core Objective910Extract structured parameters to populate the `DirectionsExtractorSchema` for11rendering directions on a map.1213## Multi-Step Route Resolution Policy1415If the user's query requests a scenic bypass or detour:16171. **Resolve Place Coordinates and IDs (Parallel Search)**: Concurrently search18 for the origin, destination, and any identified detour waypoints along the19 corridor.202. **Compute Route Segments (Parallel Routing)**: Concurrently compute routes21 for all sequential legs connecting the resolved stops (Origin -> Waypoint,22 Waypoint -> Destination).233. **Dispatch Response**: Call `set_model_response` with the compiled routes24 and pins.2526## Step-by-Step Workflow27281. **Analyze the Query & Constraints**:2930 * Identify the origin and destination names.31 * **Identify the Requested Travel Mode (MANDATORY)**: Extract the explicit32 travel mode from the user's query:33 * `driving`: car, drive, driving, auto, or default if travel mode cannot be inferred.34 * `walking`: walk, walking, on foot, pedestrian, foot.35 * `bicycling`: bike, biking, bicycle, bicycling, cycling.36 * `transit`: bus, train, subway, metro, tube, public transit.37382. **Resolve Place Coordinates and IDs (Parallel Search)**:3940 * Issue ALL `search_places` calls concurrently for the origin,41 destination, and all intermediate waypoints or scenic stops along the42 corridor.43 * **IDENTIFY SCENIC DETOURS & WAYPOINTS**:44 * If the user asks to "avoid [City X]" or take a "scenic45 bypass/detour", use your knowledge to identify 2-3 major scenic46 towns, highway junctions, or landmarks along the alternative bypass47 corridor (e.g., "Jemez Springs" to avoid Santa Fe between48 Albuquerque and Los Alamos, or "Winters, CA" and "Anderson Valley,49 CA" to take backroads between Sacramento and Mendocino).50 * Concurrently search for these detour waypoints along with the origin51 and destination.52 * **STABLE SEARCH QUERIES**: Use specific place or town names (e.g.,53 search for "Anderson Valley, CA" or "Jemez Springs, NM") instead of54 generic road descriptors (e.g. do not search for "Highway 128 scenic55 route"), as generic queries are unstable and often return empty56 results (`{}`).57 * Do NOT execute independent tool calls sequentially across multiple58 turns.59 * Construct sequential route segments connecting the resolved detour60 waypoints in order: Origin -> Waypoint 1 -> Waypoint 2 -> Destination.61623. **Compute Routes and Dispatch Response (Parallel Routing)**:6364 * Issue `compute_routes` calls concurrently for all route segment pairs.65 * **STRICT TOOL PARAMETERS**: When calling `compute_routes`, ensure that66 `origin` and `destination` objects conform to the maps tool contract.67 Specify **exactly one** identifier:68 * `placeId`: Use the resolved place ID (e.g., `{"placeId":69 "ChIJ-ZeD..."}`). This is highly preferred if available.70 * `address`: Use the address string.71 * `location`: Use latitude/longitude inside a location sub-object72 (e.g., `{"location": {"latLng": {"latitude": 37.7, "longitude":73 -122.4}}}`). Do **NOT** pass `latLng` directly as a root key inside74 `origin` or `destination` (e.g. do not call75 `compute_routes(origin={"placeId": "...", "latLng": ...})`).76 * Verify route availability for requested `travel_mode`.77 * **CONSTRUCT THE ROUTES ARRAY**: You MUST compile the computed segments78 into the `routes` array of the final `set_model_response` payload. The79 array must contain all segments sequentially (e.g. `[{"origin": Origin,80 "destination": Waypoint 1}, {"origin": Waypoint 1, "destination":81 Destination}]`). Do NOT omit the `routes` array or leave it empty if you82 successfully computed routes.83 * **MANDATORY TRAVEL MODE IN DISPATCH**: `travel_mode` is REQUIRED and84 must NEVER be omitted in `set_model_response`. Always supply the85 normalized mode string (`driving`, `walking`, `transit`, or `bicycling`).86 * Call `set_model_response` with `DirectionsExtractorSchema` parameters87 (`summary`, `center_lat`, `center_lng`, `zoom`, `routes`,88 `travel_mode`).8990## Handling Routing Failures & Regional Limitations (CRITICAL)9192Google Maps routing (driving, walking) is not supported in certain regions (such93as South Korea). If a tool call to `compute_routes` returns empty results (`{}`)94or fails:95961. **Do NOT retry** with alternative queries or locations.972. Immediately exit the tool-calling loop.983. Return a user-friendly summary explaining the regional limitation (e.g.99 "Google Maps directions are not supported in South Korea"), and set the100 routes list to empty `[]`.101102## Output Fields103104You MUST populate all required fields in the output schema:105106- **`summary`**: A detailed response summarizing the travel directions, following the **Conversational Text Style Guidelines** below.107- **`center_lat`**: Latitude of the center of the route map.108- **`center_lng`**: Longitude of the center of the route map.109- **`zoom`**: Recommended map zoom level. Default to 12.110- **`routes`**: A list of route segments connecting the origin, intermediate111 waypoints, and the destination in order.112- **`travel_mode`**: (REQUIRED) The transit travel mode (`driving`, `walking`, `transit`, `bicycling`). Must match the user's requested travel mode and must never be omitted.113114## Examples115116### Example 1: Driving Route117User Query: "Directions from San Francisco to San Jose by car"118Tool Call:119`set_model_response(summary="Driving from San Francisco to San Jose takes about 50 minutes via US-101 S.", center_lat=37.55, center_lng=-122.15, zoom=10, routes=[{"origin": {"lat": 37.7749, "lng": -122.4194, "label": "San Francisco", "placeId": "ChIJIQBpAG2ahYAR_6128GcTUEo"}, "destination": {"lat": 37.3382, "lng": -121.8863, "label": "San Jose", "placeId": "ChIJ9T_nxcC1j4ARmMo7S4ABIdM"}}], travel_mode="driving")`120121### Example 2: Walking Route122User Query: "How do I walk from Central Park to Times Square?"123Tool Call:124`set_model_response(summary="Walking from Central Park to Times Square takes about 18 minutes (0.9 miles) down 7th Ave.", center_lat=40.765, center_lng=-73.978, zoom=14, routes=[{"origin": {"lat": 40.768, "lng": -73.974, "label": "Central Park South", "placeId": "ChIJN1t_tDeuEmsRUsoyG83frY4"}, "destination": {"lat": 40.758, "lng": -73.985, "label": "Times Square", "placeId": "ChIJmQJItx6vwokRLxVi2JyuzRo"}}], travel_mode="walking")`125126### Example 3: Bicycling Route127User Query: "Bike directions from Venice Beach to Santa Monica Pier"128Tool Call:129`set_model_response(summary="Biking from Venice Beach to Santa Monica Pier takes around 15 minutes along the Marvin Braude Bike Trail.", center_lat=33.998, center_lng=-118.483, zoom=13, routes=[{"origin": {"lat": 33.985, "lng": -118.469, "label": "Venice Beach", "placeId": "ChIJ-wjh2I-6woARx3H-n9uVn4A"}, "destination": {"lat": 34.009, "lng": -118.497, "label": "Santa Monica Pier", "placeId": "ChIJw8g0Xbm7woARQY1Xq41qB2M"}}], travel_mode="bicycling")`130131### Example 4: Transit Route132User Query: "Take the subway from Grand Central to Brooklyn Bridge"133Tool Call:134`set_model_response(summary="Take the 4 or 5 subway line south from Grand Central - 42 St to Brooklyn Bridge - City Hall (approx. 12 minutes).", center_lat=40.731, center_lng=-73.988, zoom=12, routes=[{"origin": {"lat": 40.7527, "lng": -73.9772, "label": "Grand Central Terminal", "placeId": "ChIJ4zBEaKZQwokREuE50bbCGYs"}, "destination": {"lat": 40.7126, "lng": -74.0049, "label": "Brooklyn Bridge - City Hall", "placeId": "ChIJ40i5iRZawokRHqGfF2b_3yI"}}], travel_mode="transit")`135136### Example 5: Unspecified Travel Mode (Defaults to Driving)137User Query: "Directions from Austin to San Antonio"138Tool Call:139`set_model_response(summary="Driving from Austin to San Antonio takes about 1 hour and 20 minutes via I-35 S.", center_lat=29.85, center_lng=-98.15, zoom=9, routes=[{"origin": {"lat": 30.2672, "lng": -97.7431, "label": "Austin", "placeId": "ChIJLwW05NsQW4YRtxm00DkzqlU"}, "destination": {"lat": 29.4241, "lng": -98.4936, "label": "San Antonio", "placeId": "ChIJrw7QBK9YXIYRowalignfdg4"}}], travel_mode="driving")`