imprint-mcp 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +6 -4
  2. package/examples/discoverandgo/README.md +1 -1
  3. package/examples/discoverandgo/book_discoverandgo_museum_pass/workflow.json +7 -0
  4. package/examples/google-flights/README.md +41 -14
  5. package/examples/google-flights/_shared/google_batchexecute_parser.ts +165 -0
  6. package/examples/google-flights/_shared/google_flights_transport.ts +70 -0
  7. package/examples/google-flights/_shared/google_flights_types.ts +56 -0
  8. package/examples/google-flights/get_flight_booking_options/backends.json +43 -0
  9. package/examples/google-flights/get_flight_booking_options/index.ts +129 -0
  10. package/examples/google-flights/get_flight_booking_options/parser.ts +209 -0
  11. package/examples/google-flights/get_flight_booking_options/playbook.yaml +46 -0
  12. package/examples/google-flights/get_flight_booking_options/request-transform.ts +210 -0
  13. package/examples/google-flights/get_flight_booking_options/workflow.json +85 -0
  14. package/examples/google-flights/get_flight_calendar_prices/backends.json +27 -0
  15. package/examples/google-flights/get_flight_calendar_prices/index.ts +44 -29
  16. package/examples/google-flights/get_flight_calendar_prices/parser.ts +76 -69
  17. package/examples/google-flights/get_flight_calendar_prices/playbook.yaml +67 -40
  18. package/examples/google-flights/get_flight_calendar_prices/workflow.json +29 -17
  19. package/examples/google-flights/get_flight_location_details/backends.json +27 -0
  20. package/examples/google-flights/{lookup_airport → get_flight_location_details}/index.ts +30 -20
  21. package/examples/google-flights/get_flight_location_details/parser.ts +103 -0
  22. package/examples/google-flights/get_flight_location_details/playbook.yaml +59 -0
  23. package/examples/google-flights/{lookup_airport → get_flight_location_details}/workflow.json +19 -12
  24. package/examples/google-flights/lookup_flight_locations/backends.json +27 -0
  25. package/examples/google-flights/lookup_flight_locations/index.ts +111 -0
  26. package/examples/google-flights/lookup_flight_locations/package.json +9 -0
  27. package/examples/google-flights/lookup_flight_locations/parser.ts +135 -0
  28. package/examples/google-flights/lookup_flight_locations/playbook.yaml +47 -0
  29. package/examples/google-flights/lookup_flight_locations/request-transform.ts +53 -0
  30. package/examples/google-flights/lookup_flight_locations/workflow.json +64 -0
  31. package/examples/google-flights/search_flights/backends.json +42 -0
  32. package/examples/google-flights/search_flights/index.ts +105 -69
  33. package/examples/google-flights/search_flights/parser.ts +186 -183
  34. package/examples/google-flights/search_flights/playbook.yaml +295 -88
  35. package/examples/google-flights/search_flights/request-transform.ts +247 -92
  36. package/examples/google-flights/search_flights/workflow.json +66 -40
  37. package/examples/google-flights/validate_flight_itinerary/backends.json +27 -0
  38. package/examples/google-flights/validate_flight_itinerary/index.ts +103 -0
  39. package/examples/google-flights/validate_flight_itinerary/package.json +9 -0
  40. package/examples/google-flights/validate_flight_itinerary/parser.ts +101 -0
  41. package/examples/google-flights/validate_flight_itinerary/playbook.yaml +84 -0
  42. package/examples/google-flights/validate_flight_itinerary/request-transform.ts +92 -0
  43. package/examples/google-flights/validate_flight_itinerary/workflow.json +59 -0
  44. package/examples/google-hotels/README.md +40 -15
  45. package/examples/google-hotels/get_hotel_details/backends.json +16 -0
  46. package/examples/google-hotels/get_hotel_details/index.ts +122 -0
  47. package/examples/google-hotels/get_hotel_details/parser.ts +275 -0
  48. package/examples/google-hotels/get_hotel_details/playbook.yaml +40 -0
  49. package/examples/google-hotels/get_hotel_details/request-transform.ts +67 -0
  50. package/examples/google-hotels/get_hotel_details/workflow.json +67 -0
  51. package/examples/google-hotels/get_hotel_photos/backends.json +16 -0
  52. package/examples/google-hotels/get_hotel_photos/index.ts +90 -0
  53. package/examples/google-hotels/get_hotel_photos/parser.ts +75 -0
  54. package/examples/google-hotels/get_hotel_photos/playbook.yaml +23 -0
  55. package/examples/google-hotels/get_hotel_photos/request-transform.ts +27 -0
  56. package/examples/google-hotels/get_hotel_photos/workflow.json +44 -0
  57. package/examples/google-hotels/get_hotel_reviews/backends.json +16 -0
  58. package/examples/google-hotels/get_hotel_reviews/index.ts +14 -17
  59. package/examples/google-hotels/get_hotel_reviews/parser.ts +177 -105
  60. package/examples/google-hotels/get_hotel_reviews/playbook.yaml +9 -54
  61. package/examples/google-hotels/get_hotel_reviews/workflow.json +10 -13
  62. package/examples/google-hotels/get_travel_area_boundaries/backends.json +16 -0
  63. package/examples/google-hotels/get_travel_area_boundaries/index.ts +104 -0
  64. package/examples/google-hotels/get_travel_area_boundaries/package.json +9 -0
  65. package/examples/google-hotels/get_travel_area_boundaries/parser.ts +127 -0
  66. package/examples/google-hotels/get_travel_area_boundaries/playbook.yaml +38 -0
  67. package/examples/google-hotels/get_travel_area_boundaries/request-transform.ts +52 -0
  68. package/examples/google-hotels/get_travel_area_boundaries/workflow.json +54 -0
  69. package/examples/google-hotels/list_hotel_booking_options/backends.json +16 -0
  70. package/examples/google-hotels/list_hotel_booking_options/index.ts +123 -0
  71. package/examples/google-hotels/list_hotel_booking_options/package.json +9 -0
  72. package/examples/google-hotels/list_hotel_booking_options/parser.ts +308 -0
  73. package/examples/google-hotels/list_hotel_booking_options/playbook.yaml +95 -0
  74. package/examples/google-hotels/list_hotel_booking_options/request-transform.ts +77 -0
  75. package/examples/google-hotels/list_hotel_booking_options/workflow.json +67 -0
  76. package/examples/google-hotels/search_hotel_web_links/backends.json +16 -0
  77. package/examples/google-hotels/search_hotel_web_links/index.ts +90 -0
  78. package/examples/google-hotels/search_hotel_web_links/package.json +9 -0
  79. package/examples/google-hotels/search_hotel_web_links/parser.ts +96 -0
  80. package/examples/google-hotels/search_hotel_web_links/playbook.yaml +53 -0
  81. package/examples/google-hotels/search_hotel_web_links/request-transform.ts +17 -0
  82. package/examples/google-hotels/search_hotel_web_links/workflow.json +43 -0
  83. package/examples/google-hotels/search_hotels/backends.json +16 -0
  84. package/examples/google-hotels/search_hotels/index.ts +32 -102
  85. package/examples/google-hotels/search_hotels/parser.ts +237 -216
  86. package/examples/google-hotels/search_hotels/playbook.yaml +177 -42
  87. package/examples/google-hotels/search_hotels/request-transform.ts +101 -170
  88. package/examples/google-hotels/search_hotels/workflow.json +24 -73
  89. package/examples/google-hotels/suggest_hotel_destinations/backends.json +16 -0
  90. package/examples/google-hotels/{autocomplete_hotel_location → suggest_hotel_destinations}/index.ts +30 -19
  91. package/examples/google-hotels/suggest_hotel_destinations/package.json +9 -0
  92. package/examples/google-hotels/suggest_hotel_destinations/parser.ts +138 -0
  93. package/examples/google-hotels/suggest_hotel_destinations/playbook.yaml +47 -0
  94. package/examples/google-hotels/suggest_hotel_destinations/request-transform.ts +33 -0
  95. package/examples/google-hotels/suggest_hotel_destinations/workflow.json +44 -0
  96. package/examples/southwest/README.md +31 -70
  97. package/examples/southwest/get_account_details/backends.json +22 -0
  98. package/examples/southwest/get_account_details/credentials.manifest.json +17 -0
  99. package/examples/southwest/get_account_details/index.ts +138 -0
  100. package/examples/{google-hotels/_shared → southwest/get_account_details}/package.json +2 -2
  101. package/examples/southwest/get_account_details/parser.ts +136 -0
  102. package/examples/southwest/get_account_details/playbook.yaml +19 -0
  103. package/examples/southwest/get_account_details/workflow.json +93 -0
  104. package/examples/southwest/get_flight_status/backends.json +21 -0
  105. package/examples/southwest/get_flight_status/index.ts +130 -0
  106. package/examples/southwest/get_flight_status/package.json +9 -0
  107. package/examples/southwest/get_flight_status/parser.ts +138 -0
  108. package/examples/southwest/get_flight_status/playbook.yaml +58 -0
  109. package/examples/southwest/get_flight_status/workflow.json +77 -0
  110. package/examples/southwest/get_low_fare_calendar/backends.json +21 -0
  111. package/examples/southwest/get_low_fare_calendar/index.ts +134 -0
  112. package/examples/southwest/get_low_fare_calendar/package.json +9 -0
  113. package/examples/southwest/get_low_fare_calendar/parser.ts +107 -0
  114. package/examples/southwest/get_low_fare_calendar/playbook.yaml +41 -0
  115. package/examples/southwest/get_low_fare_calendar/workflow.json +81 -0
  116. package/examples/southwest/list_upcoming_trips/backends.json +22 -0
  117. package/examples/southwest/list_upcoming_trips/credentials.manifest.json +17 -0
  118. package/examples/southwest/list_upcoming_trips/index.ts +123 -0
  119. package/examples/southwest/list_upcoming_trips/package.json +9 -0
  120. package/examples/southwest/list_upcoming_trips/parser.ts +160 -0
  121. package/examples/southwest/list_upcoming_trips/playbook.yaml +24 -0
  122. package/examples/southwest/list_upcoming_trips/workflow.json +78 -0
  123. package/examples/southwest/search_flights/backends.json +21 -0
  124. package/examples/southwest/search_flights/index.ts +150 -0
  125. package/examples/southwest/search_flights/package.json +9 -0
  126. package/examples/southwest/search_flights/parser.ts +214 -0
  127. package/examples/southwest/search_flights/playbook.yaml +52 -0
  128. package/examples/southwest/search_flights/workflow.json +88 -0
  129. package/package.json +1 -1
  130. package/prompts/audit-agent.md +2 -1
  131. package/prompts/build-planning.md +22 -1
  132. package/prompts/compile-agent.md +66 -53
  133. package/prompts/prereq-builder.md +3 -1
  134. package/prompts/tool-planning.md +2 -0
  135. package/src/cli.ts +8 -3
  136. package/src/imprint/audit.ts +337 -44
  137. package/src/imprint/backend-cache.ts +114 -0
  138. package/src/imprint/backend-ladder.ts +74 -24
  139. package/src/imprint/bot-defense.ts +12 -0
  140. package/src/imprint/build-plan.ts +346 -53
  141. package/src/imprint/cdp-browser-fetch.ts +96 -43
  142. package/src/imprint/cdp-jar-cache.ts +6 -5
  143. package/src/imprint/chromium.ts +34 -0
  144. package/src/imprint/codex-cli-compile.ts +13 -2
  145. package/src/imprint/compile-agent.ts +3 -1
  146. package/src/imprint/compile-tools.ts +715 -138
  147. package/src/imprint/compile.ts +41 -9
  148. package/src/imprint/concurrency.ts +26 -3
  149. package/src/imprint/cron.ts +0 -3
  150. package/src/imprint/endpoint-key.ts +23 -0
  151. package/src/imprint/llm-url.ts +69 -0
  152. package/src/imprint/llm.ts +366 -47
  153. package/src/imprint/login.ts +83 -75
  154. package/src/imprint/mcp-compile-server.ts +4 -1
  155. package/src/imprint/mcp-server.ts +51 -16
  156. package/src/imprint/param-grounding.ts +61 -52
  157. package/src/imprint/probe-backends.ts +21 -115
  158. package/src/imprint/redact.ts +17 -15
  159. package/src/imprint/request-capture.ts +94 -0
  160. package/src/imprint/runtime.ts +1 -78
  161. package/src/imprint/session-diff.ts +14 -1
  162. package/src/imprint/stealth-fetch.ts +30 -20
  163. package/src/imprint/stealth-token-cache.ts +2 -2
  164. package/src/imprint/teach-plan.ts +2 -0
  165. package/src/imprint/teach-state.ts +14 -9
  166. package/src/imprint/teach.ts +41 -7
  167. package/src/imprint/telemetry.ts +3 -0
  168. package/src/imprint/tool-candidates.ts +8 -7
  169. package/src/imprint/tool-plan.ts +29 -3
  170. package/src/imprint/tracing.ts +18 -2
  171. package/examples/google-flights/_shared/batchexecute.ts +0 -63
  172. package/examples/google-flights/_shared/flights_request.ts +0 -97
  173. package/examples/google-flights/get_flight_booking_details/index.ts +0 -159
  174. package/examples/google-flights/get_flight_booking_details/parser.ts +0 -182
  175. package/examples/google-flights/get_flight_booking_details/playbook.yaml +0 -138
  176. package/examples/google-flights/get_flight_booking_details/request-transform.ts +0 -86
  177. package/examples/google-flights/get_flight_booking_details/workflow.json +0 -98
  178. package/examples/google-flights/get_flight_calendar_prices/request-transform.ts +0 -31
  179. package/examples/google-flights/lookup_airport/parser.ts +0 -66
  180. package/examples/google-flights/lookup_airport/playbook.yaml +0 -47
  181. package/examples/google-flights/lookup_airport/request-transform.ts +0 -20
  182. package/examples/google-hotels/_shared/batchexecute.ts +0 -73
  183. package/examples/google-hotels/_shared/freq.ts +0 -158
  184. package/examples/google-hotels/autocomplete_hotel_location/parser.ts +0 -71
  185. package/examples/google-hotels/autocomplete_hotel_location/playbook.yaml +0 -36
  186. package/examples/google-hotels/autocomplete_hotel_location/request-transform.ts +0 -37
  187. package/examples/google-hotels/autocomplete_hotel_location/workflow.json +0 -36
  188. package/examples/google-hotels/get_hotel_booking_options/index.ts +0 -143
  189. package/examples/google-hotels/get_hotel_booking_options/parser.ts +0 -271
  190. package/examples/google-hotels/get_hotel_booking_options/playbook.yaml +0 -154
  191. package/examples/google-hotels/get_hotel_booking_options/request-transform.ts +0 -154
  192. package/examples/google-hotels/get_hotel_booking_options/workflow.json +0 -84
  193. package/examples/google-hotels/get_hotel_reviews/request-transform.ts +0 -42
  194. package/examples/southwest/search_southwest_flights/backends.json +0 -23
  195. package/examples/southwest/search_southwest_flights/cron.json +0 -19
  196. package/examples/southwest/search_southwest_flights/index.ts +0 -127
  197. package/examples/southwest/search_southwest_flights/playbook.yaml +0 -46
  198. package/examples/southwest/search_southwest_flights/workflow.json +0 -71
  199. /package/examples/google-flights/{get_flight_booking_details → get_flight_booking_options}/package.json +0 -0
  200. /package/examples/google-flights/{lookup_airport → get_flight_location_details}/package.json +0 -0
  201. /package/examples/google-hotels/{autocomplete_hotel_location → get_hotel_details}/package.json +0 -0
  202. /package/examples/google-hotels/{get_hotel_booking_options → get_hotel_photos}/package.json +0 -0
@@ -0,0 +1,47 @@
1
+ toolName: lookup_flight_locations
2
+ summary: Search Google Flights location autocomplete for airports, cities, and travel places by text query.
3
+ parameters:
4
+ - name: query
5
+ type: string
6
+ description: Partial or full airport, city, or place query typed by the user.
7
+ - name: location_types
8
+ type: string
9
+ description: Optional comma-separated type filters such as airport, city, region, or all.
10
+ default: all
11
+ steps:
12
+ - action: navigate
13
+ url: "https://www.google.com/travel/flights"
14
+ wait_for: networkidle
15
+ - action: click
16
+ locators:
17
+ - by: role
18
+ value: textbox
19
+ name: "Where from?"
20
+ - by: aria_label
21
+ value_pattern: "Where from\\??\\s*$"
22
+ - by: text
23
+ value_pattern: "Where from"
24
+ - by: css
25
+ value: "input[aria-label^=\"Where from\"]"
26
+ wait_for:
27
+ sleep_ms: 300
28
+ - action: type
29
+ locators:
30
+ - by: role
31
+ value: textbox
32
+ name: "Where else?"
33
+ - by: aria_label
34
+ value_pattern: "Where (else|from|to)\\??"
35
+ - by: css
36
+ value: "div.lJj3Hd input.II2One"
37
+ - by: css
38
+ value: "input[aria-label^=\"Where\"]"
39
+ value: "${query}"
40
+ wait_for:
41
+ xhr: "rpcids=H028ib"
42
+ result:
43
+ source: xhr
44
+ url_pattern: "rpcids=H028ib"
45
+ extract: "0.0.2"
46
+ return_as: locations
47
+ notes: "The H028ib batchexecute response wraps the ranked location matches as a JSON-encoded string at the first wrb.fr record's payload; downstream parsing should remove the Google prefix, parse the batchexecute envelope, then parse this payload. The DOM autocomplete does not expose a visible location_types filter, so filtering should be applied after extraction when location_types is not all."
@@ -0,0 +1,53 @@
1
+ import { transform as googleFlightsTransform } from '../_shared/google_flights_transport.ts';
2
+
3
+ const RPC_ID = 'H028ib';
4
+ const DEFAULT_TYPE_CODES = [1, 2, 3, 5];
5
+ const ALL_TYPE_CODES = [1, 2, 3, 5, 4];
6
+ const STATE_F_SID = '${state.f_sid}';
7
+ const STATE_BL = '${state.bl}';
8
+ const ENCODED_STATE_F_SID = encodeURIComponent(STATE_F_SID);
9
+ const ENCODED_STATE_BL = encodeURIComponent(STATE_BL);
10
+
11
+ type RuntimeParams = Record<string, string | number | boolean | undefined>;
12
+
13
+ function normalizeQuery(params?: RuntimeParams): string {
14
+ const query = params?.query;
15
+ return typeof query === 'string' && query.trim() ? query : 'san di';
16
+ }
17
+
18
+ function typeCodesFor(params?: RuntimeParams): number[] {
19
+ const raw = String(params?.location_types ?? 'default').toLowerCase();
20
+ const requested = raw.split(',').map((part) => part.trim()).filter(Boolean);
21
+ return requested.includes('all') ? ALL_TYPE_CODES : DEFAULT_TYPE_CODES;
22
+ }
23
+
24
+ export function transform(
25
+ method: string,
26
+ url: string,
27
+ responses: unknown[],
28
+ params?: RuntimeParams,
29
+ ): { url: string; body: string; headers: Record<string, string> } {
30
+ const innerPayload = [normalizeQuery(params), typeCodesFor(params), null, [1, 1, 1], 1];
31
+ const fReq = [[[RPC_ID, JSON.stringify(innerPayload), null, 'generic']]];
32
+
33
+ const built = googleFlightsTransform(method, url, responses, {
34
+ fReq,
35
+ rpcid: RPC_ID,
36
+ sourcePath: '/travel/flights',
37
+ referer: 'https://www.google.com/travel/flights',
38
+ state: {
39
+ 'f.sid': STATE_F_SID,
40
+ bl: STATE_BL,
41
+ },
42
+ headers: {
43
+ 'x-goog-ext-259736195-jspb': '["en-US","US","USD",2,null,[420],null,null,7,[]]',
44
+ },
45
+ });
46
+
47
+ return {
48
+ ...built,
49
+ url: built.url
50
+ .replaceAll(ENCODED_STATE_F_SID, STATE_F_SID)
51
+ .replaceAll(ENCODED_STATE_BL, STATE_BL),
52
+ };
53
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "toolName": "lookup_flight_locations",
3
+ "site": "google-flights",
4
+ "intent": {
5
+ "description": "Search Google Flights location autocomplete for airports, cities, and travel places by text query.",
6
+ "userSaid": "searched for a round trip flight; multi city from SJC to SAN to LAX to SFO; searched for a multi city flight"
7
+ },
8
+ "parameters": [
9
+ {
10
+ "name": "query",
11
+ "type": "string",
12
+ "description": "Partial or full airport, city, or place query typed by the user.",
13
+ "default": "san di",
14
+ "verified": true
15
+ },
16
+ {
17
+ "name": "location_types",
18
+ "type": "string",
19
+ "description": "Optional type filter. Use default for recorded Google Flights location types, or all to include the expanded region/county type.",
20
+ "default": "default",
21
+ "verified": true
22
+ }
23
+ ],
24
+ "bootstrap": {
25
+ "url": "https://www.google.com/travel/flights",
26
+ "waitUntil": "load",
27
+ "waitMs": 1000,
28
+ "captures": [
29
+ {
30
+ "source": "html_regex",
31
+ "name": "f_sid",
32
+ "pattern": "(?:\\\\?\"|&quot;)FdrFJe(?:\\\\?\"|&quot;)\\s*:\\s*(?:\\\\?\"|&quot;)(-?[0-9]+)",
33
+ "group": 1,
34
+ "required": true,
35
+ "capability": "browser_bootstrap"
36
+ },
37
+ {
38
+ "source": "html_regex",
39
+ "name": "bl",
40
+ "pattern": "(?:\\\\?\"|&quot;)cfb2h(?:\\\\?\"|&quot;)\\s*:\\s*(?:\\\\?\"|&quot;)(boq_travel-frontend-flights-ui_[^\\\\\"&]+)",
41
+ "group": 1,
42
+ "required": true,
43
+ "capability": "browser_bootstrap"
44
+ }
45
+ ]
46
+ },
47
+ "requestTransformModule": "./request-transform.ts",
48
+ "parserModule": "./parser.ts",
49
+ "requests": [
50
+ {
51
+ "method": "POST",
52
+ "url": "https://www.google.com/_/FlightsFrontendUi/data/batchexecute?rpcids=H028ib&source-path=%2Ftravel%2Fflights&f.sid=${state.f_sid}&bl=${state.bl}&hl=en-US&soc-app=162&soc-platform=1&soc-device=1&rt=c",
53
+ "headers": {
54
+ "X-Same-Domain": "1",
55
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
56
+ "Referer": "https://www.google.com/travel/flights",
57
+ "x-goog-ext-259736195-jspb": "[\"en-US\",\"US\",\"USD\",2,null,[420],null,null,7,[]]"
58
+ },
59
+ "body": "f.req=${param.query}&location_types=${param.location_types}",
60
+ "effect": "safe"
61
+ }
62
+ ],
63
+ "liveVerified": true
64
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "probedAt": "2026-07-01T02:17:34.792Z",
3
+ "imprintVersion": "0.5.0",
4
+ "schemaVersion": 2,
5
+ "workflowHash": "8b76b166bf0f7d4e903f0c5901939f9e44b6b2bf50907691a0f747912b54ff5c",
6
+ "capabilityHash": "5fc16811cd65aff7afee349ddca05c806a65c9c2c96948192ea1bafba9284c38",
7
+ "preferredOrder": [
8
+ "cdp-replay",
9
+ "stealth-fetch"
10
+ ],
11
+ "results": {
12
+ "fetch": {
13
+ "outcome": "failed",
14
+ "durationMs": 61,
15
+ "error": "STATE_MISSING",
16
+ "detail": "Workflow placeholder ${state.bl} but state \"bl\" has not been captured yet"
17
+ },
18
+ "fetch-bootstrap": {
19
+ "outcome": "forbidden",
20
+ "durationMs": 30315,
21
+ "detail": "fetch-bootstrap: cdp-minted jar did not validate; cdp-replay (in-page) required."
22
+ },
23
+ "cdp-replay": {
24
+ "outcome": "ok",
25
+ "durationMs": 30447,
26
+ "coldDurationMs": 30447,
27
+ "warmDurationMs": 886,
28
+ "rankingDurationMs": 886,
29
+ "detail": "warm cdp-replay succeeded in 886ms"
30
+ },
31
+ "stealth-fetch": {
32
+ "outcome": "ok",
33
+ "durationMs": 6206
34
+ },
35
+ "playbook": {
36
+ "outcome": "failed",
37
+ "durationMs": 28,
38
+ "error": "UNKNOWN",
39
+ "detail": "Missing required parameter: return_time_range\n→ pass --param return_time_range=<value> on the CLI, or set it in cron.json."
40
+ }
41
+ }
42
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Tool: search_flights
5
5
  * Site: google-flights
6
- * Intent: Search Google Flights for itineraries between two airports with dates, trip type, and filters (stops, airlines, price, times, duration, bags).
6
+ * Intent: Search Google Flights for one-way, round-trip, or multi-city flight options with filters.
7
7
  *
8
8
  * To regenerate: imprint emit ~/.imprint/google-flights/search_flights/workflow.json --force
9
9
  */
@@ -19,99 +19,124 @@ import type { ToolResult, Workflow } from 'imprint/types';
19
19
  const WORKFLOW: Workflow = {
20
20
  "toolName": "search_flights",
21
21
  "intent": {
22
- "description": "Search Google Flights for itineraries between two airports with dates, trip type, and filters (stops, airlines, price, times, duration, bags).",
23
- "userSaid": "searched for a round trip flight; searched for a one way flight; played with the stops and the airlines filters; added bags; played with the price and time filters; played with the duration filter; did a multi city flight query"
22
+ "description": "Search Google Flights for one-way, round-trip, or multi-city flight options with filters.",
23
+ "userSaid": "searched for a round trip flight; searched for a one way flight; played with the stops and the airlines filters; added bags; played with the price and time filters; played with the duration filter"
24
24
  },
25
25
  "parameters": [
26
+ {
27
+ "name": "trip_type",
28
+ "type": "string",
29
+ "description": "Ticket type such as round_trip, one_way, or multi_city.",
30
+ "default": "round_trip",
31
+ "verified": false,
32
+ "verifyNote": "annotated"
33
+ },
26
34
  {
27
35
  "name": "origin",
28
36
  "type": "string",
29
- "description": "Origin airport/city IATA code, e.g. SJC",
37
+ "description": "Origin airport code, city code, or place identifier for one-way and round-trip searches.",
38
+ "default": "SJC",
30
39
  "verified": false,
31
40
  "verifyNote": "annotated"
32
41
  },
33
42
  {
34
43
  "name": "destination",
35
44
  "type": "string",
36
- "description": "Destination airport/city IATA code, e.g. SAN",
45
+ "description": "Destination airport code, city code, or place identifier for one-way and round-trip searches.",
46
+ "default": "SAN",
37
47
  "verified": false,
38
48
  "verifyNote": "annotated"
39
49
  },
40
50
  {
41
51
  "name": "departure_date",
42
52
  "type": "string",
43
- "description": "Outbound date in YYYY-MM-DD",
53
+ "description": "Departure date in YYYY-MM-DD format.",
54
+ "default": "2026-07-12",
44
55
  "verified": false,
45
56
  "verifyNote": "annotated"
46
57
  },
47
58
  {
48
59
  "name": "return_date",
49
60
  "type": "string",
50
- "description": "Return date in YYYY-MM-DD (omit/empty for one way)",
51
- "default": "",
61
+ "description": "Return date in YYYY-MM-DD format for round-trip searches.",
62
+ "default": "2026-07-16",
52
63
  "verified": false,
53
64
  "verifyNote": "annotated"
54
65
  },
55
66
  {
56
- "name": "trip_type",
67
+ "name": "itinerary",
57
68
  "type": "string",
58
- "description": "round_trip, one_way, or multi_city",
59
- "default": "round_trip",
69
+ "description": "Multi-city itinerary as semicolon-separated origin,destination,date legs, such as SFO,LAX,2026-09-01;LAX,JFK,2026-09-04. Supplying this value selects multi-city search semantics.",
70
+ "default": "",
60
71
  "verified": false,
61
72
  "verifyNote": "annotated"
62
73
  },
63
74
  {
64
- "name": "max_stops",
65
- "type": "number",
66
- "description": "Max stops: 0=nonstop, 1=<=1 stop, 2=<=2 stops, 3=any",
67
- "default": 3,
68
- "verified": false,
69
- "verifyNote": "annotated"
75
+ "name": "selection_token",
76
+ "type": "string",
77
+ "description": "Selection token from a prior search_flights result. For staged round-trip or multi-city selection, pass this with selected_flights to fetch the next leg options.",
78
+ "default": "",
79
+ "verified": true
70
80
  },
71
81
  {
72
- "name": "airlines",
82
+ "name": "selected_flights",
73
83
  "type": "string",
74
- "description": "Comma-separated alliance (ONEWORLD/SKYTEAM/STAR_ALLIANCE) or 2-letter carrier codes (e.g. AS,WN). Empty = no filter",
84
+ "description": "JSON array of already selected leg tuples from a prior search_flights result. For staged round-trip or multi-city selection, pass this with selection_token to fetch the next leg options and emit a complete selected_flights array.",
75
85
  "default": "",
76
- "verified": false,
77
- "verifyNote": "annotated"
86
+ "verified": true
78
87
  },
79
88
  {
80
- "name": "max_price",
89
+ "name": "adults",
81
90
  "type": "number",
82
- "description": "Maximum total price in USD (0 = no filter)",
83
- "default": 0,
91
+ "description": "Number of adult passengers.",
92
+ "default": 1,
84
93
  "verified": false,
85
94
  "verifyNote": "annotated"
86
95
  },
87
96
  {
88
- "name": "outbound_times",
97
+ "name": "stops",
89
98
  "type": "string",
90
- "description": "Outbound departure window in hours, e.g. '6-23' (empty = no filter)",
91
- "default": "",
99
+ "description": "Stops filter for routes with both nonstop and connecting options, such as any, nonstop_only, one_stop_or_fewer, or two_stops_or_fewer.",
100
+ "default": "any",
92
101
  "verified": false,
93
102
  "verifyNote": "annotated"
94
103
  },
95
104
  {
96
- "name": "return_times",
105
+ "name": "airlines",
97
106
  "type": "string",
98
- "description": "Return departure window in hours, e.g. '6-23' (empty = no filter)",
107
+ "description": "Comma-separated airline or alliance codes to include, such as AS, AA, WN, ONEWORLD, SKYTEAM, or STAR_ALLIANCE.",
99
108
  "default": "",
100
109
  "verified": false,
101
110
  "verifyNote": "annotated"
102
111
  },
103
112
  {
104
- "name": "max_duration",
113
+ "name": "bags",
105
114
  "type": "number",
106
- "description": "Maximum total trip duration in minutes, e.g. 540 (0 = no filter)",
115
+ "description": "Number of bags to include in fare filtering.",
107
116
  "default": 0,
108
117
  "verified": false,
109
118
  "verifyNote": "annotated"
110
119
  },
111
120
  {
112
- "name": "carry_on_bags",
121
+ "name": "max_price",
113
122
  "type": "number",
114
- "description": "Number of carry-on bags to filter/price by (0 = no filter)",
123
+ "description": "Maximum fare price in USD.",
124
+ "default": 0,
125
+ "verified": false,
126
+ "verifyNote": "annotated"
127
+ },
128
+ {
129
+ "name": "outbound_time_range",
130
+ "type": "string",
131
+ "description": "Outbound departure or arrival time constraints encoded as start and end hours, such as 2-21.",
132
+ "default": "",
133
+ "verified": false,
134
+ "verifyNote": "annotated"
135
+ },
136
+ {
137
+ "name": "max_duration_minutes",
138
+ "type": "number",
139
+ "description": "Maximum flight duration in minutes.",
115
140
  "default": 0,
116
141
  "verified": false,
117
142
  "verifyNote": "annotated"
@@ -120,29 +145,30 @@ const WORKFLOW: Workflow = {
120
145
  "requests": [
121
146
  {
122
147
  "method": "POST",
123
- "url": "https://www.google.com/_/FlightsFrontendUi/data/travel.frontend.flights.FlightsFrontendService/GetShoppingResults?f.sid=${state.f_sid}&bl=${state.bl}&hl=en-US&soc-app=162&soc-platform=1&soc-device=1&_reqid=1708023&rt=c",
148
+ "url": "https://www.google.com/_/FlightsFrontendUi/data/travel.frontend.flights.FlightsFrontendService/GetShoppingResults?f.sid=${state.f_sid}&bl=${state.bl}&hl=en-US&soc-app=162&soc-platform=1&soc-device=1&_reqid=${generated.nonce}&rt=c",
124
149
  "headers": {
125
150
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
126
151
  "X-Same-Domain": "1",
127
- "Referer": "https://www.google.com/travel/flights",
152
+ "Referer": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTA2LTA4agcIARIDU0pDcgcIARIDU0FOGh4SCjIwMjYtMDYtMTFqBwgBEgNTQU5yBwgBEgNTSkNAAUgBcAGCAQsI____________AZgBAQ",
153
+ "Accept-Language": "en-US,en;q=0.9",
154
+ "sec-ch-ua-full-version": "\"148.0.7778.96\"",
128
155
  "x-goog-ext-259736195-jspb": "[\"en-US\",\"US\",\"USD\",2,null,[420],null,null,7,[]]"
129
156
  },
130
- "body": "f.req=${param.origin}|${param.destination}|${param.departure_date}|${param.return_date}|${param.trip_type}|${param.max_stops}|${param.airlines}|${param.max_price}|${param.outbound_times}|${param.return_times}|${param.max_duration}|${param.carry_on_bags}&",
157
+ "body": "trip_type=${param.trip_type}&origin=${param.origin}&destination=${param.destination}&departure_date=${param.departure_date}&return_date=${param.return_date}&itinerary=${param.itinerary}&selection_token=${param.selection_token}&selected_flights=${param.selected_flights}&adults=${param.adults}&stops=${param.stops}&airlines=${param.airlines}&bags=${param.bags}&max_price=${param.max_price}&outbound_time_range=${param.outbound_time_range}&max_duration_minutes=${param.max_duration_minutes}",
131
158
  "effect": "safe"
132
159
  }
133
160
  ],
134
161
  "site": "google-flights",
135
162
  "bootstrap": {
136
- "url": "https://www.google.com/travel/flights",
163
+ "url": "https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI2LTA2LTA4agcIARIDU0pDcgcIARIDU0FOGh4SCjIwMjYtMDYtMTFqBwgBEgNTQU5yBwgBEgNTSkNAAUgBcAGCAQsI____________AZgBAQ",
137
164
  "waitUntil": "domcontentloaded",
138
- "timeoutMs": 30000,
139
165
  "captures": [
140
166
  {
141
167
  "name": "f_sid",
142
168
  "required": true,
143
169
  "capability": "browser_bootstrap",
144
170
  "source": "html_regex",
145
- "pattern": "\"FdrFJe\":\"([^\"]+)\"",
171
+ "pattern": "\"FdrFJe\":\"(-?\\d+)\"",
146
172
  "group": 1
147
173
  },
148
174
  {
@@ -161,30 +187,36 @@ const WORKFLOW: Workflow = {
161
187
  };
162
188
 
163
189
  export interface SearchFlightsInput {
164
- /** Origin airport/city IATA code, e.g. SJC */
165
- origin: string;
166
- /** Destination airport/city IATA code, e.g. SAN */
167
- destination: string;
168
- /** Outbound date in YYYY-MM-DD */
169
- departure_date: string;
170
- /** Return date in YYYY-MM-DD (omit/empty for one way) */
171
- return_date?: string;
172
- /** round_trip, one_way, or multi_city */
190
+ /** Ticket type such as round_trip, one_way, or multi_city. */
173
191
  trip_type?: string;
174
- /** Max stops: 0=nonstop, 1=<=1 stop, 2=<=2 stops, 3=any */
175
- max_stops?: number;
176
- /** Comma-separated alliance (ONEWORLD/SKYTEAM/STAR_ALLIANCE) or 2-letter carrier codes (e.g. AS,WN). Empty = no filter */
192
+ /** Origin airport code, city code, or place identifier for one-way and round-trip searches. */
193
+ origin?: string;
194
+ /** Destination airport code, city code, or place identifier for one-way and round-trip searches. */
195
+ destination?: string;
196
+ /** Departure date in YYYY-MM-DD format. */
197
+ departure_date?: string;
198
+ /** Return date in YYYY-MM-DD format for round-trip searches. */
199
+ return_date?: string;
200
+ /** Multi-city itinerary as semicolon-separated origin,destination,date legs, such as SFO,LAX,2026-09-01;LAX,JFK,2026-09-04. Supplying this value selects multi-city search semantics. */
201
+ itinerary?: string;
202
+ /** Selection token from a prior search_flights result. For staged round-trip or multi-city selection, pass this with selected_flights to fetch the next leg options. */
203
+ selection_token?: string;
204
+ /** JSON array of already selected leg tuples from a prior search_flights result. For staged round-trip or multi-city selection, pass this with selection_token to fetch the next leg options and emit a complete selected_flights array. */
205
+ selected_flights?: string;
206
+ /** Number of adult passengers. */
207
+ adults?: number;
208
+ /** Stops filter for routes with both nonstop and connecting options, such as any, nonstop_only, one_stop_or_fewer, or two_stops_or_fewer. */
209
+ stops?: string;
210
+ /** Comma-separated airline or alliance codes to include, such as AS, AA, WN, ONEWORLD, SKYTEAM, or STAR_ALLIANCE. */
177
211
  airlines?: string;
178
- /** Maximum total price in USD (0 = no filter) */
212
+ /** Number of bags to include in fare filtering. */
213
+ bags?: number;
214
+ /** Maximum fare price in USD. */
179
215
  max_price?: number;
180
- /** Outbound departure window in hours, e.g. '6-23' (empty = no filter) */
181
- outbound_times?: string;
182
- /** Return departure window in hours, e.g. '6-23' (empty = no filter) */
183
- return_times?: string;
184
- /** Maximum total trip duration in minutes, e.g. 540 (0 = no filter) */
185
- max_duration?: number;
186
- /** Number of carry-on bags to filter/price by (0 = no filter) */
187
- carry_on_bags?: number;
216
+ /** Outbound departure or arrival time constraints encoded as start and end hours, such as 2-21. */
217
+ outbound_time_range?: string;
218
+ /** Maximum flight duration in minutes. */
219
+ max_duration_minutes?: number;
188
220
  }
189
221
 
190
222
  export async function searchFlights(
@@ -193,18 +225,22 @@ export async function searchFlights(
193
225
  ): Promise<ToolResult> {
194
226
  const __dirname = dirname(fileURLToPath(import.meta.url));
195
227
  const params: Record<string, string | number | boolean> = {
196
- return_date: input.return_date ?? "",
197
228
  trip_type: input.trip_type ?? "round_trip",
198
- max_stops: input.max_stops ?? 3,
229
+ origin: input.origin ?? "SJC",
230
+ destination: input.destination ?? "SAN",
231
+ departure_date: input.departure_date ?? "2026-07-12",
232
+ return_date: input.return_date ?? "2026-07-16",
233
+ itinerary: input.itinerary ?? "",
234
+ selection_token: input.selection_token ?? "",
235
+ selected_flights: input.selected_flights ?? "",
236
+ adults: input.adults ?? 1,
237
+ stops: input.stops ?? "any",
199
238
  airlines: input.airlines ?? "",
239
+ bags: input.bags ?? 0,
200
240
  max_price: input.max_price ?? 0,
201
- outbound_times: input.outbound_times ?? "",
202
- return_times: input.return_times ?? "",
203
- max_duration: input.max_duration ?? 0,
204
- carry_on_bags: input.carry_on_bags ?? 0,
205
- origin: input.origin,
206
- destination: input.destination,
207
- departure_date: input.departure_date,
241
+ outbound_time_range: input.outbound_time_range ?? "",
242
+ max_duration_minutes: input.max_duration_minutes ?? 0,
243
+
208
244
  };
209
245
  return executeWorkflow({
210
246
  workflow: WORKFLOW,