mastra-scavio 0.2.0 → 0.3.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.
- package/dist/index.cjs +377 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -18
- package/dist/index.d.ts +4 -18
- package/dist/index.js +377 -89
- package/dist/index.js.map +1 -1
- package/package.json +14 -4
package/dist/index.cjs
CHANGED
|
@@ -55,39 +55,327 @@ function getScavioClient(config) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/google.ts
|
|
58
|
+
var import_zod2 = require("zod");
|
|
59
|
+
|
|
60
|
+
// src/tool.ts
|
|
58
61
|
var import_tools = require("@mastra/core/tools");
|
|
59
62
|
var import_zod = require("zod");
|
|
60
63
|
var outputSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.unknown());
|
|
61
|
-
function
|
|
64
|
+
function defineScavioTool(spec) {
|
|
65
|
+
return spec;
|
|
66
|
+
}
|
|
67
|
+
function createScavioTool(spec, config) {
|
|
62
68
|
let client = null;
|
|
63
69
|
const getClient = () => client ??= getScavioClient(config);
|
|
64
70
|
return (0, import_tools.createTool)({
|
|
65
|
-
id:
|
|
66
|
-
description:
|
|
67
|
-
inputSchema:
|
|
68
|
-
query: import_zod.z.string().describe("The search query"),
|
|
69
|
-
country_code: import_zod.z.string().optional().describe('Two-letter country code, e.g. "us"'),
|
|
70
|
-
language: import_zod.z.string().optional().describe('Two-letter language code, e.g. "en"'),
|
|
71
|
-
page: import_zod.z.number().optional().describe("Result page number (1-based)"),
|
|
72
|
-
device: import_zod.z.enum(["desktop", "mobile"]).optional().describe("Device to emulate"),
|
|
73
|
-
nfpr: import_zod.z.boolean().optional().describe("Disable spelling correction / auto-fixes")
|
|
74
|
-
}),
|
|
71
|
+
id: spec.id,
|
|
72
|
+
description: spec.description,
|
|
73
|
+
inputSchema: spec.inputSchema,
|
|
75
74
|
outputSchema,
|
|
76
|
-
execute: async (
|
|
77
|
-
query,
|
|
78
|
-
...country_code !== void 0 ? { gl: country_code } : {},
|
|
79
|
-
...language !== void 0 ? { hl: language } : {},
|
|
80
|
-
...page !== void 0 && page > 1 ? { start: (page - 1) * 10 } : {},
|
|
81
|
-
...device !== void 0 ? { device } : {},
|
|
82
|
-
...nfpr !== void 0 ? { nfpr } : {}
|
|
83
|
-
})
|
|
75
|
+
execute: async (input) => spec.call(getClient(), input)
|
|
84
76
|
});
|
|
85
77
|
}
|
|
78
|
+
function toolFactory(specs, key) {
|
|
79
|
+
const spec = specs.find((candidate) => candidate.key === key);
|
|
80
|
+
if (!spec) {
|
|
81
|
+
throw new Error(`Unknown Scavio tool spec: ${key}`);
|
|
82
|
+
}
|
|
83
|
+
return (config) => createScavioTool(spec, config);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/google.ts
|
|
87
|
+
var gl = import_zod2.z.string().optional().describe("Country of the search (ISO 3166-1 alpha-2, e.g. 'us', 'gb', 'de').");
|
|
88
|
+
var hl = import_zod2.z.string().optional().describe("UI language (ISO 639-1, e.g. 'en').");
|
|
89
|
+
var googleDomain = import_zod2.z.string().optional().describe("Regional Google domain, e.g. 'google.co.uk'.");
|
|
90
|
+
var location = import_zod2.z.string().optional().describe("Canonical location name, e.g. 'Austin, Texas, United States'. Encoded server-side.");
|
|
91
|
+
var device = import_zod2.z.enum(["desktop", "mobile"]).optional().describe("Device to emulate.");
|
|
92
|
+
var currency = import_zod2.z.string().optional().describe("Currency code (ISO 4217, e.g. 'USD').");
|
|
93
|
+
var checkInDate = import_zod2.z.string().describe("Check-in date (YYYY-MM-DD).");
|
|
94
|
+
var checkOutDate = import_zod2.z.string().describe("Check-out date (YYYY-MM-DD).");
|
|
95
|
+
var googleToolSpecs = [
|
|
96
|
+
defineScavioTool({
|
|
97
|
+
key: "scavioGoogleSearch",
|
|
98
|
+
id: "scavio-google-search",
|
|
99
|
+
platform: "google",
|
|
100
|
+
endpoint: "/api/v2/google",
|
|
101
|
+
credits: 1,
|
|
102
|
+
description: "Search Google in real time via Scavio (1 credit). Returns organic_results (each with title, link and snippet) plus knowledge_graph, related_questions, ads and the AI overview when Google shows one. The body is flat - read organic_results at the top level, not under data.",
|
|
103
|
+
inputSchema: import_zod2.z.object({
|
|
104
|
+
query: import_zod2.z.string().describe("The search query (1-500 characters)."),
|
|
105
|
+
gl,
|
|
106
|
+
hl,
|
|
107
|
+
google_domain: googleDomain,
|
|
108
|
+
location,
|
|
109
|
+
device,
|
|
110
|
+
start: import_zod2.z.number().optional().describe("Result offset, not a page number: 0 is page 1, 10 is page 2, up to 990."),
|
|
111
|
+
time_period: import_zod2.z.enum(["last_hour", "last_day", "last_week", "last_month", "last_year"]).optional().describe("Restrict results to a recent time window."),
|
|
112
|
+
safe: import_zod2.z.literal("active").optional().describe("Turn SafeSearch on with 'active'."),
|
|
113
|
+
nfpr: import_zod2.z.boolean().optional().describe("Disable spelling correction and auto-fixes.")
|
|
114
|
+
}),
|
|
115
|
+
call: (client, input) => client.google.search(input)
|
|
116
|
+
}),
|
|
117
|
+
defineScavioTool({
|
|
118
|
+
key: "scavioGoogleAiMode",
|
|
119
|
+
id: "scavio-google-ai-mode",
|
|
120
|
+
platform: "google",
|
|
121
|
+
endpoint: "/api/v2/google/ai-mode",
|
|
122
|
+
credits: 1,
|
|
123
|
+
description: "Ask Google AI Mode a question via Scavio (1 credit). Returns Google's generated answer with its cited sources - use it for a synthesized answer, and scavio-google-search for a ranked result list.",
|
|
124
|
+
inputSchema: import_zod2.z.object({
|
|
125
|
+
query: import_zod2.z.string().describe("Question or prompt (1-500 characters)."),
|
|
126
|
+
gl,
|
|
127
|
+
hl,
|
|
128
|
+
google_domain: googleDomain,
|
|
129
|
+
location,
|
|
130
|
+
device,
|
|
131
|
+
safe: import_zod2.z.literal("active").optional().describe("Turn SafeSearch on with 'active'.")
|
|
132
|
+
}),
|
|
133
|
+
call: (client, input) => client.google.aiMode(input)
|
|
134
|
+
}),
|
|
135
|
+
defineScavioTool({
|
|
136
|
+
key: "scavioGoogleMapsSearch",
|
|
137
|
+
id: "scavio-google-maps-search",
|
|
138
|
+
platform: "google",
|
|
139
|
+
endpoint: "/api/v2/google/maps/search",
|
|
140
|
+
credits: 1,
|
|
141
|
+
description: "Search Google Maps for local businesses and places via Scavio (1 credit). Returns local results with ratings, review counts, addresses, phone numbers and place ids. Feed a place_id into scavio-google-maps-place or scavio-google-maps-reviews.",
|
|
142
|
+
inputSchema: import_zod2.z.object({
|
|
143
|
+
query: import_zod2.z.string().describe("Search query, e.g. 'coffee shops in Austin' (1-500 characters)."),
|
|
144
|
+
ll: import_zod2.z.string().optional().describe("Map centre as '@lat,lng,zoomz'; controls which area results come from."),
|
|
145
|
+
start: import_zod2.z.number().optional().describe("Result offset; must be a multiple of 20 (0, 20, 40, ...)."),
|
|
146
|
+
gl,
|
|
147
|
+
hl,
|
|
148
|
+
google_domain: googleDomain
|
|
149
|
+
}),
|
|
150
|
+
call: (client, input) => client.google.mapsSearch(input)
|
|
151
|
+
}),
|
|
152
|
+
defineScavioTool({
|
|
153
|
+
key: "scavioGoogleMapsPlace",
|
|
154
|
+
id: "scavio-google-maps-place",
|
|
155
|
+
platform: "google",
|
|
156
|
+
endpoint: "/api/v2/google/maps/place",
|
|
157
|
+
credits: 1,
|
|
158
|
+
description: "Fetch one Google Maps place in full via Scavio (1 credit): hours, address, phone, website, rating, price level and photos. Provide place_id or data_cid.",
|
|
159
|
+
inputSchema: import_zod2.z.object({
|
|
160
|
+
place_id: import_zod2.z.string().optional().describe("Place ID (starts with ChIJ)."),
|
|
161
|
+
data_cid: import_zod2.z.string().optional().describe("Numeric CID, as an alternative to place_id.")
|
|
162
|
+
}),
|
|
163
|
+
call: (client, input) => client.google.mapsPlace(input)
|
|
164
|
+
}),
|
|
165
|
+
defineScavioTool({
|
|
166
|
+
key: "scavioGoogleMapsReviews",
|
|
167
|
+
id: "scavio-google-maps-reviews",
|
|
168
|
+
platform: "google",
|
|
169
|
+
endpoint: "/api/v2/google/maps/reviews",
|
|
170
|
+
credits: 1,
|
|
171
|
+
description: "List Google Maps reviews for a place via Scavio (1 credit). Provide data_id or place_id. Page with next_page_token; each page costs another credit.",
|
|
172
|
+
inputSchema: import_zod2.z.object({
|
|
173
|
+
place_id: import_zod2.z.string().optional().describe("Place ID (starts with ChIJ)."),
|
|
174
|
+
data_id: import_zod2.z.string().optional().describe("Data ID in 0xHEX:0xHEX form."),
|
|
175
|
+
num: import_zod2.z.number().optional().describe("Reviews per page (1-20)."),
|
|
176
|
+
sort_by: import_zod2.z.enum(["relevance", "newest", "highest_rating", "lowest_rating"]).optional().describe("Review sort order."),
|
|
177
|
+
next_page_token: import_zod2.z.string().optional().describe("Pagination cursor from a prior response."),
|
|
178
|
+
gl,
|
|
179
|
+
hl,
|
|
180
|
+
google_domain: googleDomain
|
|
181
|
+
}),
|
|
182
|
+
call: (client, input) => client.google.mapsReviews(input)
|
|
183
|
+
}),
|
|
184
|
+
defineScavioTool({
|
|
185
|
+
key: "scavioGoogleShopping",
|
|
186
|
+
id: "scavio-google-shopping",
|
|
187
|
+
platform: "google",
|
|
188
|
+
endpoint: "/api/v2/google/shopping",
|
|
189
|
+
credits: 1,
|
|
190
|
+
description: "Search Google Shopping via Scavio (1 credit). Returns product cards with prices, merchants, ratings and catalog ids across retailers - use it for cross-retailer price comparison, and scavio-amazon-search or scavio-walmart-search for a single marketplace.",
|
|
191
|
+
inputSchema: import_zod2.z.object({
|
|
192
|
+
query: import_zod2.z.string().describe("Product search query (1-500 characters)."),
|
|
193
|
+
min_price: import_zod2.z.number().optional().describe("Minimum price filter."),
|
|
194
|
+
max_price: import_zod2.z.number().optional().describe("Maximum price filter."),
|
|
195
|
+
sort_by: import_zod2.z.number().optional().describe("0 = relevance, 1 = price ascending, 2 = price descending."),
|
|
196
|
+
free_shipping: import_zod2.z.boolean().optional().describe("Only items with free shipping."),
|
|
197
|
+
on_sale: import_zod2.z.boolean().optional().describe("Only items on sale."),
|
|
198
|
+
start: import_zod2.z.number().optional().describe("Result offset."),
|
|
199
|
+
gl,
|
|
200
|
+
hl,
|
|
201
|
+
google_domain: googleDomain,
|
|
202
|
+
location,
|
|
203
|
+
device
|
|
204
|
+
}),
|
|
205
|
+
call: (client, input) => client.google.shopping(input)
|
|
206
|
+
}),
|
|
207
|
+
defineScavioTool({
|
|
208
|
+
key: "scavioGoogleShoppingProduct",
|
|
209
|
+
id: "scavio-google-shopping-product",
|
|
210
|
+
platform: "google",
|
|
211
|
+
endpoint: "/api/v2/google/shopping/product",
|
|
212
|
+
credits: 1,
|
|
213
|
+
description: "Fetch one Google Shopping product via Scavio (1 credit): specs, reviews, and the sellers carrying it. Pass catalog_id together with query for full detail and the seller list.",
|
|
214
|
+
inputSchema: import_zod2.z.object({
|
|
215
|
+
catalog_id: import_zod2.z.string().optional().describe("Durable product catalog id from a shopping search."),
|
|
216
|
+
query: import_zod2.z.string().optional().describe("Product query. Required when catalog_id is set."),
|
|
217
|
+
product_id: import_zod2.z.string().optional().describe("Product id, as an alternative to catalog_id."),
|
|
218
|
+
page_token: import_zod2.z.string().optional().describe("Immersive product page token."),
|
|
219
|
+
sort_by: import_zod2.z.enum(["base_price", "total_price", "promotion", "seller_rating"]).optional().describe("Seller sort order."),
|
|
220
|
+
load_all_stores: import_zod2.z.boolean().optional().describe("Load every available store."),
|
|
221
|
+
more_stores: import_zod2.z.boolean().optional().describe("Fetch additional stores."),
|
|
222
|
+
gl,
|
|
223
|
+
hl,
|
|
224
|
+
google_domain: googleDomain,
|
|
225
|
+
location,
|
|
226
|
+
device: import_zod2.z.enum(["desktop", "mobile", "tablet"]).optional().describe("Device to emulate.")
|
|
227
|
+
}),
|
|
228
|
+
call: (client, input) => client.google.shoppingProduct(input)
|
|
229
|
+
}),
|
|
230
|
+
defineScavioTool({
|
|
231
|
+
key: "scavioGoogleShoppingStores",
|
|
232
|
+
id: "scavio-google-shopping-stores",
|
|
233
|
+
platform: "google",
|
|
234
|
+
endpoint: "/api/v2/google/shopping/product/stores",
|
|
235
|
+
credits: 1,
|
|
236
|
+
description: "Fetch the next page of sellers for a Google Shopping product via Scavio (1 credit). Continuation of scavio-google-shopping-product: pass the same catalog_id plus that response next_page_token.",
|
|
237
|
+
inputSchema: import_zod2.z.object({
|
|
238
|
+
catalog_id: import_zod2.z.string().describe("Durable product catalog id."),
|
|
239
|
+
next_page_token: import_zod2.z.string().describe("Pagination cursor from scavio-google-shopping-product.")
|
|
240
|
+
}),
|
|
241
|
+
call: (client, input) => client.google.shoppingStores(input)
|
|
242
|
+
}),
|
|
243
|
+
defineScavioTool({
|
|
244
|
+
key: "scavioGoogleFlights",
|
|
245
|
+
id: "scavio-google-flights",
|
|
246
|
+
platform: "google",
|
|
247
|
+
endpoint: "/api/v2/google/flights",
|
|
248
|
+
credits: 1,
|
|
249
|
+
description: "Search Google Flights via Scavio (1 credit). Returns itineraries with prices, airlines, stops, durations and carbon emissions. Airports are IATA codes; dates are YYYY-MM-DD.",
|
|
250
|
+
inputSchema: import_zod2.z.object({
|
|
251
|
+
departure_id: import_zod2.z.string().describe("Departure IATA code(s), comma-separated allowed, e.g. 'JFK'."),
|
|
252
|
+
arrival_id: import_zod2.z.string().describe("Arrival IATA code(s), comma-separated allowed, e.g. 'LHR'."),
|
|
253
|
+
outbound_date: import_zod2.z.string().describe("Outbound date (YYYY-MM-DD)."),
|
|
254
|
+
return_date: import_zod2.z.string().optional().describe("Return date (YYYY-MM-DD). Required when type is 1."),
|
|
255
|
+
type: import_zod2.z.number().optional().describe("1 = round trip (default), 2 = one way, 3 = multi-city."),
|
|
256
|
+
adults: import_zod2.z.number().optional().describe("Number of adults (1-9)."),
|
|
257
|
+
children: import_zod2.z.number().optional().describe("Number of children (0-9)."),
|
|
258
|
+
travel_class: import_zod2.z.number().optional().describe("1 = economy, 2 = premium economy, 3 = business, 4 = first."),
|
|
259
|
+
stops: import_zod2.z.number().optional().describe("0 = any, 1 = nonstop, 2 = one stop or fewer, 3 = two or fewer."),
|
|
260
|
+
sort_by: import_zod2.z.number().optional().describe("1 = top, 2 = price, 3 = departure, 4 = arrival, 5 = duration, 6 = emissions."),
|
|
261
|
+
include_airlines: import_zod2.z.string().optional().describe("Comma-separated airline or alliance codes to include."),
|
|
262
|
+
exclude_airlines: import_zod2.z.string().optional().describe("Comma-separated airline or alliance codes to exclude."),
|
|
263
|
+
currency,
|
|
264
|
+
gl,
|
|
265
|
+
hl
|
|
266
|
+
}),
|
|
267
|
+
call: (client, input) => client.google.flights(input)
|
|
268
|
+
}),
|
|
269
|
+
defineScavioTool({
|
|
270
|
+
key: "scavioGoogleHotels",
|
|
271
|
+
id: "scavio-google-hotels",
|
|
272
|
+
platform: "google",
|
|
273
|
+
endpoint: "/api/v2/google/hotels",
|
|
274
|
+
credits: 1,
|
|
275
|
+
description: "Search Google Hotels via Scavio (1 credit). Returns properties with nightly prices, ratings, amenities and a detail_token for scavio-google-hotels-detail. Phrase the query as '<City> hotels'.",
|
|
276
|
+
inputSchema: import_zod2.z.object({
|
|
277
|
+
query: import_zod2.z.string().describe("Search query; use a '<City> hotels' form."),
|
|
278
|
+
check_in_date: checkInDate,
|
|
279
|
+
check_out_date: checkOutDate,
|
|
280
|
+
sort_by: import_zod2.z.number().optional().describe("3 = lowest price, 8 = highest rating, 13 = most reviewed."),
|
|
281
|
+
min_price: import_zod2.z.number().optional().describe("Minimum nightly price."),
|
|
282
|
+
max_price: import_zod2.z.number().optional().describe("Maximum nightly price."),
|
|
283
|
+
rating: import_zod2.z.number().optional().describe("7 = 3.5+, 8 = 4.0+, 9 = 4.5+."),
|
|
284
|
+
hotel_class: import_zod2.z.string().optional().describe("Comma-separated star ratings (2-5)."),
|
|
285
|
+
amenities: import_zod2.z.string().optional().describe("Comma-separated amenity ids."),
|
|
286
|
+
property_types: import_zod2.z.string().optional().describe("Comma-separated property-type ids, e.g. '12' for vacation rentals."),
|
|
287
|
+
free_cancellation: import_zod2.z.boolean().optional().describe("Only properties with free cancellation."),
|
|
288
|
+
eco_certified: import_zod2.z.boolean().optional().describe("Only eco-certified properties."),
|
|
289
|
+
special_offers: import_zod2.z.boolean().optional().describe("Only properties with special offers."),
|
|
290
|
+
limit: import_zod2.z.number().optional().describe("Number of properties to return (1-20)."),
|
|
291
|
+
next_page_token: import_zod2.z.string().optional().describe("Pagination cursor from a prior response."),
|
|
292
|
+
currency,
|
|
293
|
+
gl,
|
|
294
|
+
hl
|
|
295
|
+
}),
|
|
296
|
+
call: (client, input) => client.google.hotels(input)
|
|
297
|
+
}),
|
|
298
|
+
defineScavioTool({
|
|
299
|
+
key: "scavioGoogleHotelsDetail",
|
|
300
|
+
id: "scavio-google-hotels-detail",
|
|
301
|
+
platform: "google",
|
|
302
|
+
endpoint: "/api/v2/google/hotels/detail",
|
|
303
|
+
credits: 1,
|
|
304
|
+
description: "Fetch one Google Hotels property in full via Scavio (1 credit): room types, per-night prices by provider, amenities, photos and reviews. Needs a detail_token from scavio-google-hotels and the same stay dates.",
|
|
305
|
+
inputSchema: import_zod2.z.object({
|
|
306
|
+
detail_token: import_zod2.z.string().describe("Property detail token from a hotels listing."),
|
|
307
|
+
check_in_date: checkInDate,
|
|
308
|
+
check_out_date: checkOutDate,
|
|
309
|
+
currency,
|
|
310
|
+
gl,
|
|
311
|
+
hl
|
|
312
|
+
}),
|
|
313
|
+
call: (client, input) => client.google.hotelsDetail(input)
|
|
314
|
+
}),
|
|
315
|
+
defineScavioTool({
|
|
316
|
+
key: "scavioGoogleNews",
|
|
317
|
+
id: "scavio-google-news",
|
|
318
|
+
platform: "google",
|
|
319
|
+
endpoint: "/api/v2/google/news",
|
|
320
|
+
credits: 1,
|
|
321
|
+
description: "Fetch Google News via Scavio (1 credit). Pass query to search, or a topic_token / story_token / publication_token from an earlier response to browse a topic, a full story or one publisher.",
|
|
322
|
+
inputSchema: import_zod2.z.object({
|
|
323
|
+
query: import_zod2.z.string().optional().describe("Keyword search."),
|
|
324
|
+
topic_token: import_zod2.z.string().optional().describe("Browse a news topic."),
|
|
325
|
+
section_token: import_zod2.z.string().optional().describe("Browse a topic section."),
|
|
326
|
+
story_token: import_zod2.z.string().optional().describe("Fetch full coverage of one story."),
|
|
327
|
+
publication_token: import_zod2.z.string().optional().describe("Browse one publication."),
|
|
328
|
+
so: import_zod2.z.number().optional().describe("Sort: 0 = relevance, 1 = date. Only applies with query."),
|
|
329
|
+
gl,
|
|
330
|
+
hl,
|
|
331
|
+
google_domain: googleDomain
|
|
332
|
+
}),
|
|
333
|
+
call: (client, input) => client.google.news(input)
|
|
334
|
+
}),
|
|
335
|
+
defineScavioTool({
|
|
336
|
+
key: "scavioGoogleTrends",
|
|
337
|
+
id: "scavio-google-trends",
|
|
338
|
+
platform: "google",
|
|
339
|
+
endpoint: "/api/v2/google/trends",
|
|
340
|
+
credits: 1,
|
|
341
|
+
description: "Fetch Google Trends interest data via Scavio (1 credit). Comma-separate the query to compare terms, and pick the dataset with data_type: TIMESERIES for interest over time, GEO_MAP for interest by region, RELATED_QUERIES or RELATED_TOPICS for rising searches.",
|
|
342
|
+
inputSchema: import_zod2.z.object({
|
|
343
|
+
query: import_zod2.z.string().describe("Search term(s); comma-separated to compare up to five."),
|
|
344
|
+
data_type: import_zod2.z.enum(["TIMESERIES", "GEO_MAP", "GEO_MAP_0", "RELATED_QUERIES", "RELATED_TOPICS"]).optional().describe("Which trends dataset to return."),
|
|
345
|
+
geo: import_zod2.z.string().optional().describe("Location code, e.g. 'US', 'GB', 'US-CA'. Omit for worldwide."),
|
|
346
|
+
date: import_zod2.z.string().optional().describe("Time range, e.g. 'today 12-m', 'now 7-d'."),
|
|
347
|
+
cat: import_zod2.z.string().optional().describe("Category id."),
|
|
348
|
+
gprop: import_zod2.z.enum(["images", "news", "youtube", "froogle"]).optional().describe("Restrict to a Google property."),
|
|
349
|
+
region: import_zod2.z.enum(["COUNTRY", "REGION", "DMA", "CITY"]).optional().describe("Resolution for GEO_MAP data."),
|
|
350
|
+
tz: import_zod2.z.string().optional().describe("Timezone offset in minutes."),
|
|
351
|
+
hl
|
|
352
|
+
}),
|
|
353
|
+
call: (client, input) => client.google.trends(input)
|
|
354
|
+
}),
|
|
355
|
+
defineScavioTool({
|
|
356
|
+
key: "scavioGoogleTrending",
|
|
357
|
+
id: "scavio-google-trending",
|
|
358
|
+
platform: "google",
|
|
359
|
+
endpoint: "/api/v2/google/trending",
|
|
360
|
+
credits: 1,
|
|
361
|
+
description: "List what is trending on Google right now for one country via Scavio (1 credit). geo is required. Use scavio-google-trends instead when you already know the term you care about.",
|
|
362
|
+
inputSchema: import_zod2.z.object({
|
|
363
|
+
geo: import_zod2.z.string().describe("Country code, e.g. 'US'."),
|
|
364
|
+
hours: import_zod2.z.number().optional().describe("Trending window in hours: 4, 24, 48 or 168."),
|
|
365
|
+
cat: import_zod2.z.number().optional().describe("Category id (0-20)."),
|
|
366
|
+
sort: import_zod2.z.enum(["relevance", "search_volume", "recency", "title"]).optional().describe("Sort order."),
|
|
367
|
+
status: import_zod2.z.enum(["all", "active"]).optional().describe("Filter by trend status."),
|
|
368
|
+
hl
|
|
369
|
+
}),
|
|
370
|
+
call: (client, input) => client.google.trending(input)
|
|
371
|
+
})
|
|
372
|
+
];
|
|
373
|
+
var createScavioGoogleSearchTool = toolFactory(googleToolSpecs, "scavioGoogleSearch");
|
|
86
374
|
|
|
87
375
|
// src/amazon.ts
|
|
88
376
|
var import_tools2 = require("@mastra/core/tools");
|
|
89
|
-
var
|
|
90
|
-
var outputSchema2 =
|
|
377
|
+
var import_zod3 = require("zod");
|
|
378
|
+
var outputSchema2 = import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown());
|
|
91
379
|
var COUNTRY_DESCRIPTION = "Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), ca, de, fr, es, it, jp, in, au, br, mx, nl, pl, se, sg, ae, sa, eg, cn, be, tr. An unknown code falls back to us.";
|
|
92
380
|
function createScavioAmazonSearchTool(config) {
|
|
93
381
|
let client = null;
|
|
@@ -95,10 +383,10 @@ function createScavioAmazonSearchTool(config) {
|
|
|
95
383
|
return (0, import_tools2.createTool)({
|
|
96
384
|
id: "scavio-amazon-search",
|
|
97
385
|
description: "Search Amazon for products via Scavio. Returns matching products as structured JSON. Results are unsorted and cannot be filtered by category, merchant or price.",
|
|
98
|
-
inputSchema:
|
|
99
|
-
query:
|
|
100
|
-
country:
|
|
101
|
-
page:
|
|
386
|
+
inputSchema: import_zod3.z.object({
|
|
387
|
+
query: import_zod3.z.string().describe("The product search query"),
|
|
388
|
+
country: import_zod3.z.string().optional().describe(COUNTRY_DESCRIPTION),
|
|
389
|
+
page: import_zod3.z.number().optional().describe("Result page, 1-based. One page per call, 1 credit each.")
|
|
102
390
|
}),
|
|
103
391
|
outputSchema: outputSchema2,
|
|
104
392
|
execute: async (input) => getClient().amazon.search(input)
|
|
@@ -110,9 +398,9 @@ function createScavioAmazonProductTool(config) {
|
|
|
110
398
|
return (0, import_tools2.createTool)({
|
|
111
399
|
id: "scavio-amazon-product",
|
|
112
400
|
description: "Fetch full Amazon product details by ASIN via Scavio. price is the buy-box price only.",
|
|
113
|
-
inputSchema:
|
|
114
|
-
asin:
|
|
115
|
-
country:
|
|
401
|
+
inputSchema: import_zod3.z.object({
|
|
402
|
+
asin: import_zod3.z.string().describe("Amazon Standard Identification Number (ASIN)"),
|
|
403
|
+
country: import_zod3.z.string().optional().describe(COUNTRY_DESCRIPTION)
|
|
116
404
|
}),
|
|
117
405
|
outputSchema: outputSchema2,
|
|
118
406
|
execute: async (input) => getClient().amazon.product(input)
|
|
@@ -124,9 +412,9 @@ function createScavioAmazonOffersTool(config) {
|
|
|
124
412
|
return (0, import_tools2.createTool)({
|
|
125
413
|
id: "scavio-amazon-offers",
|
|
126
414
|
description: "List every seller offer for one Amazon ASIN via Scavio: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only. Use this instead of the product tool when comparing sellers or checking who owns the buy box.",
|
|
127
|
-
inputSchema:
|
|
128
|
-
asin:
|
|
129
|
-
country:
|
|
415
|
+
inputSchema: import_zod3.z.object({
|
|
416
|
+
asin: import_zod3.z.string().describe("Amazon Standard Identification Number (ASIN)"),
|
|
417
|
+
country: import_zod3.z.string().optional().describe(COUNTRY_DESCRIPTION)
|
|
130
418
|
}),
|
|
131
419
|
outputSchema: outputSchema2,
|
|
132
420
|
execute: async (input) => getClient().amazon.offers(input)
|
|
@@ -135,19 +423,19 @@ function createScavioAmazonOffersTool(config) {
|
|
|
135
423
|
|
|
136
424
|
// src/walmart.ts
|
|
137
425
|
var import_tools3 = require("@mastra/core/tools");
|
|
138
|
-
var
|
|
139
|
-
var outputSchema3 =
|
|
426
|
+
var import_zod4 = require("zod");
|
|
427
|
+
var outputSchema3 = import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown());
|
|
140
428
|
function createScavioWalmartSearchTool(config) {
|
|
141
429
|
let client = null;
|
|
142
430
|
const getClient = () => client ??= getScavioClient(config);
|
|
143
431
|
return (0, import_tools3.createTool)({
|
|
144
432
|
id: "scavio-walmart-search",
|
|
145
433
|
description: "Search Walmart for products via Scavio. Returns matching products as structured JSON.",
|
|
146
|
-
inputSchema:
|
|
147
|
-
query:
|
|
148
|
-
sort_by:
|
|
149
|
-
min_price:
|
|
150
|
-
max_price:
|
|
434
|
+
inputSchema: import_zod4.z.object({
|
|
435
|
+
query: import_zod4.z.string().describe("The product search query"),
|
|
436
|
+
sort_by: import_zod4.z.string().optional().describe("Sort order for results"),
|
|
437
|
+
min_price: import_zod4.z.number().optional().describe("Minimum price filter"),
|
|
438
|
+
max_price: import_zod4.z.number().optional().describe("Maximum price filter")
|
|
151
439
|
}),
|
|
152
440
|
outputSchema: outputSchema3,
|
|
153
441
|
execute: async (input) => getClient().walmart.search(input)
|
|
@@ -159,8 +447,8 @@ function createScavioWalmartProductTool(config) {
|
|
|
159
447
|
return (0, import_tools3.createTool)({
|
|
160
448
|
id: "scavio-walmart-product",
|
|
161
449
|
description: "Fetch full Walmart product details by product id via Scavio.",
|
|
162
|
-
inputSchema:
|
|
163
|
-
product_id:
|
|
450
|
+
inputSchema: import_zod4.z.object({
|
|
451
|
+
product_id: import_zod4.z.string().describe("Walmart product id")
|
|
164
452
|
}),
|
|
165
453
|
outputSchema: outputSchema3,
|
|
166
454
|
execute: async (input) => getClient().walmart.product(input)
|
|
@@ -169,22 +457,22 @@ function createScavioWalmartProductTool(config) {
|
|
|
169
457
|
|
|
170
458
|
// src/youtube.ts
|
|
171
459
|
var import_tools4 = require("@mastra/core/tools");
|
|
172
|
-
var
|
|
173
|
-
var outputSchema4 =
|
|
460
|
+
var import_zod5 = require("zod");
|
|
461
|
+
var outputSchema4 = import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown());
|
|
174
462
|
function createScavioYoutubeSearchTool(config) {
|
|
175
463
|
let client = null;
|
|
176
464
|
const getClient = () => client ??= getScavioClient(config);
|
|
177
465
|
return (0, import_tools4.createTool)({
|
|
178
466
|
id: "scavio-youtube-search",
|
|
179
467
|
description: "Search YouTube for videos, channels, or playlists via Scavio.",
|
|
180
|
-
inputSchema:
|
|
181
|
-
query:
|
|
182
|
-
upload_date:
|
|
183
|
-
type:
|
|
184
|
-
duration:
|
|
185
|
-
sort_by:
|
|
186
|
-
features:
|
|
187
|
-
cursor:
|
|
468
|
+
inputSchema: import_zod5.z.object({
|
|
469
|
+
query: import_zod5.z.string().describe("The video search query"),
|
|
470
|
+
upload_date: import_zod5.z.string().optional().describe('Upload date filter, e.g. "today", "this_week", "this_month"'),
|
|
471
|
+
type: import_zod5.z.string().optional().describe('Result type, e.g. "video", "channel", "playlist", "movie"'),
|
|
472
|
+
duration: import_zod5.z.string().optional().describe('Duration filter: "short", "medium", or "long"'),
|
|
473
|
+
sort_by: import_zod5.z.string().optional().describe('Sort order: "relevance", "date", "view_count", or "rating"'),
|
|
474
|
+
features: import_zod5.z.array(import_zod5.z.string()).optional().describe('Feature filters, e.g. ["hd", "4k", "subtitles", "creative_commons", "live"]'),
|
|
475
|
+
cursor: import_zod5.z.string().optional().describe("Pagination cursor from a prior response")
|
|
188
476
|
}),
|
|
189
477
|
outputSchema: outputSchema4,
|
|
190
478
|
execute: async (input) => getClient().youtube.search(input)
|
|
@@ -196,8 +484,8 @@ function createScavioYoutubeVideoTool(config) {
|
|
|
196
484
|
return (0, import_tools4.createTool)({
|
|
197
485
|
id: "scavio-youtube-video",
|
|
198
486
|
description: "Fetch full metadata for a YouTube video by id or watch URL via Scavio.",
|
|
199
|
-
inputSchema:
|
|
200
|
-
video_id:
|
|
487
|
+
inputSchema: import_zod5.z.object({
|
|
488
|
+
video_id: import_zod5.z.string().describe("YouTube video id or full watch URL")
|
|
201
489
|
}),
|
|
202
490
|
outputSchema: outputSchema4,
|
|
203
491
|
execute: async (input) => getClient().youtube.video(input)
|
|
@@ -209,8 +497,8 @@ function createScavioYoutubeMetadataTool(config) {
|
|
|
209
497
|
return (0, import_tools4.createTool)({
|
|
210
498
|
id: "scavio-youtube-metadata",
|
|
211
499
|
description: "Deprecated alias of scavio-youtube-video: fetch metadata for a YouTube video by id via Scavio.",
|
|
212
|
-
inputSchema:
|
|
213
|
-
video_id:
|
|
500
|
+
inputSchema: import_zod5.z.object({
|
|
501
|
+
video_id: import_zod5.z.string().describe("YouTube video id")
|
|
214
502
|
}),
|
|
215
503
|
outputSchema: outputSchema4,
|
|
216
504
|
execute: async (input) => getClient().youtube.metadata(input)
|
|
@@ -222,9 +510,9 @@ function createScavioYoutubeCommentsTool(config) {
|
|
|
222
510
|
return (0, import_tools4.createTool)({
|
|
223
511
|
id: "scavio-youtube-comments",
|
|
224
512
|
description: "List the top-level comments on a YouTube video via Scavio.",
|
|
225
|
-
inputSchema:
|
|
226
|
-
video_id:
|
|
227
|
-
cursor:
|
|
513
|
+
inputSchema: import_zod5.z.object({
|
|
514
|
+
video_id: import_zod5.z.string().describe("YouTube video id or full watch URL"),
|
|
515
|
+
cursor: import_zod5.z.string().optional().describe("Pagination cursor from a prior response")
|
|
228
516
|
}),
|
|
229
517
|
outputSchema: outputSchema4,
|
|
230
518
|
execute: async (input) => getClient().youtube.comments(input)
|
|
@@ -236,8 +524,8 @@ function createScavioYoutubeChannelTool(config) {
|
|
|
236
524
|
return (0, import_tools4.createTool)({
|
|
237
525
|
id: "scavio-youtube-channel",
|
|
238
526
|
description: "Fetch details for a YouTube channel by id, @handle, or URL via Scavio.",
|
|
239
|
-
inputSchema:
|
|
240
|
-
channel_id:
|
|
527
|
+
inputSchema: import_zod5.z.object({
|
|
528
|
+
channel_id: import_zod5.z.string().describe("YouTube channel id, @handle, or channel URL")
|
|
241
529
|
}),
|
|
242
530
|
outputSchema: outputSchema4,
|
|
243
531
|
execute: async (input) => getClient().youtube.channel(input)
|
|
@@ -249,10 +537,10 @@ function createScavioYoutubeTranscriptTool(config) {
|
|
|
249
537
|
return (0, import_tools4.createTool)({
|
|
250
538
|
id: "scavio-youtube-transcript",
|
|
251
539
|
description: "Fetch the transcript or timed subtitles for a YouTube video via Scavio.",
|
|
252
|
-
inputSchema:
|
|
253
|
-
video_id:
|
|
254
|
-
language:
|
|
255
|
-
format:
|
|
540
|
+
inputSchema: import_zod5.z.object({
|
|
541
|
+
video_id: import_zod5.z.string().describe("YouTube video id or full watch URL"),
|
|
542
|
+
language: import_zod5.z.string().optional().describe('Caption language code (default "en")'),
|
|
543
|
+
format: import_zod5.z.enum(["text", "srt"]).optional().describe('"text" for plain transcript, "srt" for timed subtitles')
|
|
256
544
|
}),
|
|
257
545
|
outputSchema: outputSchema4,
|
|
258
546
|
execute: async (input) => getClient().youtube.transcript(input)
|
|
@@ -264,8 +552,8 @@ function createScavioYoutubeStreamsTool(config) {
|
|
|
264
552
|
return (0, import_tools4.createTool)({
|
|
265
553
|
id: "scavio-youtube-streams",
|
|
266
554
|
description: "Get playable and downloadable stream formats for a YouTube video via Scavio.",
|
|
267
|
-
inputSchema:
|
|
268
|
-
video_id:
|
|
555
|
+
inputSchema: import_zod5.z.object({
|
|
556
|
+
video_id: import_zod5.z.string().describe("YouTube video id or full watch URL")
|
|
269
557
|
}),
|
|
270
558
|
outputSchema: outputSchema4,
|
|
271
559
|
execute: async (input) => getClient().youtube.streams(input)
|
|
@@ -274,17 +562,17 @@ function createScavioYoutubeStreamsTool(config) {
|
|
|
274
562
|
|
|
275
563
|
// src/reddit.ts
|
|
276
564
|
var import_tools5 = require("@mastra/core/tools");
|
|
277
|
-
var
|
|
278
|
-
var outputSchema5 =
|
|
565
|
+
var import_zod6 = require("zod");
|
|
566
|
+
var outputSchema5 = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown());
|
|
279
567
|
function createScavioRedditSearchTool(config) {
|
|
280
568
|
let client = null;
|
|
281
569
|
const getClient = () => client ??= getScavioClient(config);
|
|
282
570
|
return (0, import_tools5.createTool)({
|
|
283
571
|
id: "scavio-reddit-search",
|
|
284
572
|
description: "Search Reddit posts via Scavio (1 credit). Returns matching posts under data.results, with data.next_cursor and data.has_more for paging. Results cannot be filtered or sorted.",
|
|
285
|
-
inputSchema:
|
|
286
|
-
query:
|
|
287
|
-
cursor:
|
|
573
|
+
inputSchema: import_zod6.z.object({
|
|
574
|
+
query: import_zod6.z.string().describe("The Reddit search query"),
|
|
575
|
+
cursor: import_zod6.z.string().optional().describe("Pagination cursor (next_cursor) from a prior response")
|
|
288
576
|
}),
|
|
289
577
|
outputSchema: outputSchema5,
|
|
290
578
|
execute: async (input) => getClient().reddit.search(input)
|
|
@@ -296,9 +584,9 @@ function createScavioRedditPostTool(config) {
|
|
|
296
584
|
return (0, import_tools5.createTool)({
|
|
297
585
|
id: "scavio-reddit-post",
|
|
298
586
|
description: "Fetch a single Reddit post by URL or id via Scavio (1 credit). Returns a flat post object under data (title, text, score, num_comments, ...). It carries no comments - only the num_comments count.",
|
|
299
|
-
inputSchema:
|
|
300
|
-
post_id:
|
|
301
|
-
url:
|
|
587
|
+
inputSchema: import_zod6.z.object({
|
|
588
|
+
post_id: import_zod6.z.string().optional().describe('Post fullname ("t3_...") or bare post id'),
|
|
589
|
+
url: import_zod6.z.string().optional().describe("Full URL of the Reddit post")
|
|
302
590
|
}),
|
|
303
591
|
outputSchema: outputSchema5,
|
|
304
592
|
execute: async (input) => getClient().reddit.post(input)
|
|
@@ -307,18 +595,18 @@ function createScavioRedditPostTool(config) {
|
|
|
307
595
|
|
|
308
596
|
// src/tiktok.ts
|
|
309
597
|
var import_tools6 = require("@mastra/core/tools");
|
|
310
|
-
var
|
|
311
|
-
var outputSchema6 =
|
|
598
|
+
var import_zod7 = require("zod");
|
|
599
|
+
var outputSchema6 = import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown());
|
|
312
600
|
function createScavioTiktokSearchTool(config) {
|
|
313
601
|
let client = null;
|
|
314
602
|
const getClient = () => client ??= getScavioClient(config);
|
|
315
603
|
return (0, import_tools6.createTool)({
|
|
316
604
|
id: "scavio-tiktok-search",
|
|
317
605
|
description: "Search TikTok videos by keyword via Scavio.",
|
|
318
|
-
inputSchema:
|
|
319
|
-
keyword:
|
|
320
|
-
count:
|
|
321
|
-
sort_type:
|
|
606
|
+
inputSchema: import_zod7.z.object({
|
|
607
|
+
keyword: import_zod7.z.string().describe("Search keyword"),
|
|
608
|
+
count: import_zod7.z.number().optional().describe("Number of videos to return"),
|
|
609
|
+
sort_type: import_zod7.z.string().optional().describe("Sort order for results")
|
|
322
610
|
}),
|
|
323
611
|
outputSchema: outputSchema6,
|
|
324
612
|
execute: async (input) => getClient().tiktok.searchVideos(input)
|
|
@@ -330,9 +618,9 @@ function createScavioTiktokProfileTool(config) {
|
|
|
330
618
|
return (0, import_tools6.createTool)({
|
|
331
619
|
id: "scavio-tiktok-profile",
|
|
332
620
|
description: "Fetch a TikTok user profile by username via Scavio.",
|
|
333
|
-
inputSchema:
|
|
334
|
-
username:
|
|
335
|
-
sec_user_id:
|
|
621
|
+
inputSchema: import_zod7.z.object({
|
|
622
|
+
username: import_zod7.z.string().optional().describe("TikTok username (without @)"),
|
|
623
|
+
sec_user_id: import_zod7.z.string().optional().describe("TikTok secUid")
|
|
336
624
|
}),
|
|
337
625
|
outputSchema: outputSchema6,
|
|
338
626
|
execute: async (input) => getClient().tiktok.profile(input)
|
|
@@ -341,16 +629,16 @@ function createScavioTiktokProfileTool(config) {
|
|
|
341
629
|
|
|
342
630
|
// src/instagram.ts
|
|
343
631
|
var import_tools7 = require("@mastra/core/tools");
|
|
344
|
-
var
|
|
345
|
-
var outputSchema7 =
|
|
632
|
+
var import_zod8 = require("zod");
|
|
633
|
+
var outputSchema7 = import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown());
|
|
346
634
|
function createScavioInstagramSearchTool(config) {
|
|
347
635
|
let client = null;
|
|
348
636
|
const getClient = () => client ??= getScavioClient(config);
|
|
349
637
|
return (0, import_tools7.createTool)({
|
|
350
638
|
id: "scavio-instagram-search",
|
|
351
639
|
description: "Search Instagram users by keyword via Scavio.",
|
|
352
|
-
inputSchema:
|
|
353
|
-
keyword:
|
|
640
|
+
inputSchema: import_zod8.z.object({
|
|
641
|
+
keyword: import_zod8.z.string().describe("Search keyword")
|
|
354
642
|
}),
|
|
355
643
|
outputSchema: outputSchema7,
|
|
356
644
|
execute: async (input) => getClient().instagram.searchUsers(input)
|
|
@@ -362,9 +650,9 @@ function createScavioInstagramProfileTool(config) {
|
|
|
362
650
|
return (0, import_tools7.createTool)({
|
|
363
651
|
id: "scavio-instagram-profile",
|
|
364
652
|
description: "Fetch an Instagram profile by username via Scavio.",
|
|
365
|
-
inputSchema:
|
|
366
|
-
username:
|
|
367
|
-
user_id:
|
|
653
|
+
inputSchema: import_zod8.z.object({
|
|
654
|
+
username: import_zod8.z.string().optional().describe("Instagram username"),
|
|
655
|
+
user_id: import_zod8.z.string().optional().describe("Instagram user id")
|
|
368
656
|
}),
|
|
369
657
|
outputSchema: outputSchema7,
|
|
370
658
|
execute: async (input) => getClient().instagram.profile(input)
|