@scavio/ai-sdk 0.2.1 → 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/README.md CHANGED
@@ -4,6 +4,14 @@ Scavio search tools for the [Vercel AI SDK](https://sdk.vercel.ai). Give any AI
4
4
  search across Google, YouTube, Reddit, Amazon, Walmart, TikTok, and Instagram via the
5
5
  [Scavio](https://scavio.dev) API.
6
6
 
7
+ > **Amazon changed (breaking).** The upstream provider moved in 2026-07:
8
+ > `domain` is replaced by `country`, a two-letter marketplace code (`us`, `gb`
9
+ > -- the UK is `gb`, not `uk` -- `de`, `jp`, ...), and `sort_by`, `pages`,
10
+ > `category_id`, `merchant_id`, `language`, `currency`, `device`, `zip_code`
11
+ > and `autoselect_variant` are gone. The marketplace ignores all of them
12
+ > (`sort_by` returns the identical unordered set for every value), so they are
13
+ > removed rather than kept as silent no-ops. Rank and filter results yourself.
14
+
7
15
  ## Install
8
16
 
9
17
  ```bash
@@ -22,7 +30,7 @@ import { scavioSearch, scavioTools } from "@scavio/ai-sdk";
22
30
 
23
31
  // A single tool:
24
32
  const res = await generateText({
25
- model: openai("gpt-4o-mini"),
33
+ model: openai("gpt-5.5"),
26
34
  tools: { scavio_search: scavioSearch({ maxResults: 5 }) },
27
35
  stopWhen: stepCountIs(3),
28
36
  prompt: "Find the official GitHub repo of the Agno framework",
@@ -30,7 +38,7 @@ const res = await generateText({
30
38
 
31
39
  // Or all tools at once:
32
40
  const res2 = await generateText({
33
- model: openai("gpt-4o-mini"),
41
+ model: openai("gpt-5.5"),
34
42
  tools: scavioTools(),
35
43
  stopWhen: stepCountIs(3),
36
44
  prompt: "Compare prices for a mechanical keyboard on Amazon and Walmart",
@@ -41,17 +49,33 @@ const res2 = await generateText({
41
49
 
42
50
  | Factory | Tool name | Provider |
43
51
  | --- | --- | --- |
44
- | `scavioSearch` | `scavio_search` | Google web search |
45
- | `scavioYoutubeSearch` | `scavio_youtube_search` | YouTube video search |
46
- | `scavioRedditSearch` | `scavio_reddit_search` | Reddit (2 credits) |
47
- | `scavioAmazonSearch` | `scavio_amazon_search` | Amazon products |
48
- | `scavioWalmartSearch` | `scavio_walmart_search` | Walmart products |
49
- | `scavioTiktokSearch` | `scavio_tiktok_search` | TikTok videos |
50
- | `scavioInstagramSearch` | `scavio_instagram_search` | Instagram users |
52
+ | `scavioSearch` | `scavio_search` | Google web search, `/api/v2/google` (1 credit) |
53
+ | `scavioYoutubeSearch` | `scavio_youtube_search` | YouTube video search (2 credits) |
54
+ | `scavioYoutubeVideo` | `scavio_youtube_video` | YouTube video details (1 credit) |
55
+ | `scavioYoutubeTranscript` | `scavio_youtube_transcript` | YouTube transcript / subtitles (8 credits) |
56
+ | `scavioYoutubeComments` | `scavio_youtube_comments` | YouTube video comments (1 credit) |
57
+ | `scavioYoutubeChannel` | `scavio_youtube_channel` | YouTube channel details (1 credit) |
58
+ | `scavioRedditSearch` | `scavio_reddit_search` | Reddit posts (1 credit) |
59
+ | `scavioAmazonSearch` | `scavio_amazon_search` | Amazon products (1 credit) |
60
+ | `scavioAmazonOffers` | `scavio_amazon_offers` | Amazon seller offers for one ASIN (1 credit) |
61
+ | `scavioWalmartSearch` | `scavio_walmart_search` | Walmart products (1 credit) |
62
+ | `scavioTiktokSearch` | `scavio_tiktok_search` | TikTok videos (1 credit) |
63
+ | `scavioInstagramSearch` | `scavio_instagram_search` | Instagram users (10 credits) |
51
64
  | `scavioTools` | all of the above | bundle for `tools:` |
52
65
 
53
66
  Each factory accepts `{ apiKey?, maxResults?, ...ScavioConfig }`. The key falls back to `SCAVIO_API_KEY`.
54
- Get a key at [dashboard.scavio.dev](https://dashboard.scavio.dev).
67
+ Get a key at [dashboard.scavio.dev](https://dashboard.scavio.dev) - new accounts get 50 free credits, no
68
+ credit card.
69
+
70
+ `maxResults` trims the result list in place. Google returns a flat body, so it trims
71
+ `organic_results`; every other endpoint nests its payload under `data`, so those trim inside `data`
72
+ (`data.results`, `data.products`, `data.aweme_list`, `data.users`, ...) and the
73
+ `{ data, response_time, credits_used, credits_remaining }` envelope is preserved.
74
+
75
+ These tools cover the most common surfaces. The full Scavio API - 98 endpoints across Google,
76
+ YouTube, Amazon, Walmart, Reddit, TikTok, TikTok Shop, Instagram, X and LinkedIn - is available
77
+ directly through the [`scavio`](https://www.npmjs.com/package/scavio) SDK or the
78
+ [MCP server](https://scavio.dev/docs).
55
79
 
56
80
  ## License
57
81
 
package/dist/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ scavioAmazonOffers: () => scavioAmazonOffers,
23
24
  scavioAmazonSearch: () => scavioAmazonSearch,
24
25
  scavioInstagramSearch: () => scavioInstagramSearch,
25
26
  scavioRedditSearch: () => scavioRedditSearch,
@@ -27,7 +28,11 @@ __export(index_exports, {
27
28
  scavioTiktokSearch: () => scavioTiktokSearch,
28
29
  scavioTools: () => scavioTools,
29
30
  scavioWalmartSearch: () => scavioWalmartSearch,
30
- scavioYoutubeSearch: () => scavioYoutubeSearch
31
+ scavioYoutubeChannel: () => scavioYoutubeChannel,
32
+ scavioYoutubeComments: () => scavioYoutubeComments,
33
+ scavioYoutubeSearch: () => scavioYoutubeSearch,
34
+ scavioYoutubeTranscript: () => scavioYoutubeTranscript,
35
+ scavioYoutubeVideo: () => scavioYoutubeVideo
31
36
  });
32
37
  module.exports = __toCommonJS(index_exports);
33
38
  var import_ai = require("ai");
@@ -36,10 +41,19 @@ var import_scavio = require("scavio");
36
41
  function client(config) {
37
42
  return new import_scavio.Scavio({ apiKey: config?.apiKey });
38
43
  }
39
- function trim(res, max) {
40
- const results = res.results;
41
- if (Array.isArray(results) && results.length > max) {
42
- return { ...res, results: results.slice(0, max) };
44
+ function trimFlat(res, key, max) {
45
+ const list = res[key];
46
+ if (Array.isArray(list) && list.length > max) {
47
+ return { ...res, [key]: list.slice(0, max) };
48
+ }
49
+ return res;
50
+ }
51
+ function trimData(res, key, max) {
52
+ const data = res.data;
53
+ if (!data || typeof data !== "object") return res;
54
+ const list = data[key];
55
+ if (Array.isArray(list) && list.length > max) {
56
+ return { ...res, data: { ...data, [key]: list.slice(0, max) } };
43
57
  }
44
58
  return res;
45
59
  }
@@ -47,91 +61,188 @@ function scavioSearch(config) {
47
61
  const c = client(config);
48
62
  const max = config?.maxResults ?? 10;
49
63
  return (0, import_ai.tool)({
50
- description: "Search the web with Google via the Scavio API. Returns real-time organic search results.",
64
+ description: "Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.",
51
65
  inputSchema: import_zod.z.object({
52
66
  query: import_zod.z.string().describe("The search query."),
53
- country_code: import_zod.z.string().optional().describe('Two-letter country code to localize results, e.g. "us".'),
54
- language: import_zod.z.string().optional().describe('Two-letter language code, e.g. "en".')
67
+ countryCode: import_zod.z.string().optional().describe('Two-letter country code to localize results, e.g. "us".'),
68
+ language: import_zod.z.string().optional().describe('Two-letter UI language code, e.g. "en".'),
69
+ page: import_zod.z.number().int().optional().describe("1-based result page; page 2 starts at result 10."),
70
+ device: import_zod.z.enum(["desktop", "mobile"]).optional().describe("Device to emulate."),
71
+ nfpr: import_zod.z.boolean().optional().describe("Disable spelling auto-correction / similar-result substitution when true.")
55
72
  }),
56
- execute: async ({ query, country_code, language }) => trim(await c.google.search({ query, country_code, language }), max)
73
+ execute: async ({ query, countryCode, language, page, device, nfpr }) => {
74
+ const params = { query };
75
+ if (countryCode) params.gl = countryCode;
76
+ if (language) params.hl = language;
77
+ if (page && page > 1) params.start = (page - 1) * 10;
78
+ if (device) params.device = device;
79
+ if (nfpr !== void 0) params.nfpr = nfpr;
80
+ return trimFlat(await c.google.search(params), "organic_results", max);
81
+ }
57
82
  });
58
83
  }
59
84
  function scavioYoutubeSearch(config) {
60
85
  const c = client(config);
61
86
  const max = config?.maxResults ?? 10;
62
87
  return (0, import_ai.tool)({
63
- description: "Search YouTube for videos via the Scavio API.",
88
+ description: "Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.",
89
+ inputSchema: import_zod.z.object({
90
+ query: import_zod.z.string().describe("The search query."),
91
+ upload_date: import_zod.z.string().optional().describe("Upload date filter, e.g. 'today', 'this_week', 'this_month'."),
92
+ type: import_zod.z.string().optional().describe("Result type: 'video', 'channel', 'playlist', 'movie'."),
93
+ duration: import_zod.z.string().optional().describe("Duration filter: 'short', 'medium', 'long'."),
94
+ sort_by: import_zod.z.string().optional().describe("Sort order: 'relevance', 'date', 'view_count', 'rating'."),
95
+ cursor: import_zod.z.string().optional().describe("Pagination cursor (`next_cursor`) from a prior response.")
96
+ }),
97
+ execute: async ({ query, upload_date, type, duration, sort_by, cursor }) => trimData(
98
+ await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor }),
99
+ "results",
100
+ max
101
+ )
102
+ });
103
+ }
104
+ function scavioYoutubeVideo(config) {
105
+ const c = client(config);
106
+ return (0, import_ai.tool)({
107
+ description: "Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.",
108
+ inputSchema: import_zod.z.object({
109
+ video_id: import_zod.z.string().describe("YouTube video id or a full watch URL.")
110
+ }),
111
+ execute: async ({ video_id }) => c.youtube.video({ video_id })
112
+ });
113
+ }
114
+ function scavioYoutubeTranscript(config) {
115
+ const c = client(config);
116
+ return (0, import_ai.tool)({
117
+ description: "Fetch a YouTube video's transcript or timed subtitles via the Scavio API (8 credits).",
118
+ inputSchema: import_zod.z.object({
119
+ video_id: import_zod.z.string().describe("YouTube video id or a full watch URL."),
120
+ language: import_zod.z.string().optional().describe("Transcript language code (default 'en')."),
121
+ format: import_zod.z.enum(["text", "srt"]).optional().describe("'text' for a plain transcript, 'srt' for timed subtitles.")
122
+ }),
123
+ execute: async ({ video_id, language, format }) => c.youtube.transcript({ video_id, language, format })
124
+ });
125
+ }
126
+ function scavioYoutubeComments(config) {
127
+ const c = client(config);
128
+ const max = config?.maxResults ?? 10;
129
+ return (0, import_ai.tool)({
130
+ description: "List comments on a YouTube video via the Scavio API.",
131
+ inputSchema: import_zod.z.object({
132
+ video_id: import_zod.z.string().describe("YouTube video id or a full watch URL."),
133
+ cursor: import_zod.z.string().optional().describe("Pagination cursor.")
134
+ }),
135
+ execute: async ({ video_id, cursor }) => trimData(
136
+ await c.youtube.comments({ video_id, cursor }),
137
+ "comments",
138
+ max
139
+ )
140
+ });
141
+ }
142
+ function scavioYoutubeChannel(config) {
143
+ const c = client(config);
144
+ return (0, import_ai.tool)({
145
+ description: "Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.",
64
146
  inputSchema: import_zod.z.object({
65
- query: import_zod.z.string().describe("The search query.")
147
+ channel_id: import_zod.z.string().describe("YouTube channel id, @handle, or channel URL.")
66
148
  }),
67
- execute: async ({ query }) => trim(await c.youtube.search({ query }), max)
149
+ execute: async ({ channel_id }) => c.youtube.channel({ channel_id })
68
150
  });
69
151
  }
70
152
  function scavioRedditSearch(config) {
71
153
  const c = client(config);
72
154
  const max = config?.maxResults ?? 10;
73
155
  return (0, import_ai.tool)({
74
- description: "Search Reddit posts and communities via the Scavio API.",
156
+ description: "Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.",
75
157
  inputSchema: import_zod.z.object({
76
158
  query: import_zod.z.string().describe("The search query."),
77
- sort: import_zod.z.string().optional().describe("Sort order for results.")
159
+ cursor: import_zod.z.string().optional().describe("Pagination cursor (`next_cursor`) from a prior response.")
78
160
  }),
79
- execute: async ({ query, sort }) => trim(await c.reddit.search({ query, sort }), max)
161
+ execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), "results", max)
80
162
  });
81
163
  }
82
164
  function scavioAmazonSearch(config) {
83
165
  const c = client(config);
84
166
  const max = config?.maxResults ?? 10;
85
167
  return (0, import_ai.tool)({
86
- description: "Search Amazon for products via the Scavio API.",
168
+ description: "Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.",
87
169
  inputSchema: import_zod.z.object({
88
170
  query: import_zod.z.string().describe("The product search query."),
89
- domain: import_zod.z.string().optional().describe('Amazon domain, e.g. "amazon.com".')
171
+ country: import_zod.z.string().optional().describe(
172
+ "Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us."
173
+ )
174
+ }),
175
+ execute: async ({ query, country }) => trimData(await c.amazon.search({ query, country }), "products", max)
176
+ });
177
+ }
178
+ function scavioAmazonOffers(config) {
179
+ const c = client(config);
180
+ const max = config?.maxResults ?? 10;
181
+ return (0, import_ai.tool)({
182
+ description: "List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.",
183
+ inputSchema: import_zod.z.object({
184
+ asin: import_zod.z.string().describe("Amazon Standard Identification Number (ASIN) of the product."),
185
+ country: import_zod.z.string().optional().describe(
186
+ "Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us."
187
+ )
90
188
  }),
91
- execute: async ({ query, domain }) => trim(await c.amazon.search({ query, domain }), max)
189
+ execute: async ({ asin, country }) => trimData(await c.amazon.offers({ asin, country }), "offers", max)
92
190
  });
93
191
  }
94
192
  function scavioWalmartSearch(config) {
95
193
  const c = client(config);
96
194
  const max = config?.maxResults ?? 10;
97
195
  return (0, import_ai.tool)({
98
- description: "Search Walmart for products via the Scavio API.",
196
+ description: "Search Walmart for products via the Scavio API. Products come back under `data.products`.",
99
197
  inputSchema: import_zod.z.object({
100
198
  query: import_zod.z.string().describe("The product search query.")
101
199
  }),
102
- execute: async ({ query }) => trim(await c.walmart.search({ query }), max)
200
+ execute: async ({ query }) => trimData(await c.walmart.search({ query }), "products", max)
103
201
  });
104
202
  }
105
203
  function scavioTiktokSearch(config) {
106
204
  const c = client(config);
107
205
  const max = config?.maxResults ?? 10;
108
206
  return (0, import_ai.tool)({
109
- description: "Search TikTok for videos by keyword via the Scavio API.",
207
+ description: "Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.",
110
208
  inputSchema: import_zod.z.object({
111
209
  keyword: import_zod.z.string().describe("The search keyword."),
112
- sort_type: import_zod.z.string().optional().describe("Sort order for results."),
113
- publish_time: import_zod.z.string().optional().describe("Filter by publish time window.")
210
+ sort_type: import_zod.z.enum(["0", "1"]).optional().describe("Sort order: '0' relevance, '1' most likes."),
211
+ publish_time: import_zod.z.enum(["0", "1", "7", "30", "90", "180"]).optional().describe("Publish window in days: '0' all time, '1', '7', '30', '90', '180'.")
114
212
  }),
115
- execute: async ({ keyword, sort_type, publish_time }) => trim(await c.tiktok.searchVideos({ keyword, sort_type, publish_time }), max)
213
+ execute: async ({ keyword, sort_type, publish_time }) => trimData(
214
+ await c.tiktok.searchVideos({
215
+ keyword,
216
+ sort_type,
217
+ publish_time
218
+ }),
219
+ "aweme_list",
220
+ max
221
+ )
116
222
  });
117
223
  }
118
224
  function scavioInstagramSearch(config) {
119
225
  const c = client(config);
120
226
  const max = config?.maxResults ?? 10;
121
227
  return (0, import_ai.tool)({
122
- description: "Search Instagram for users by keyword via the Scavio API.",
228
+ description: "Search Instagram for users by keyword via the Scavio API (10 credits). Users come back under `data.users`.",
123
229
  inputSchema: import_zod.z.object({
124
230
  keyword: import_zod.z.string().describe("The search keyword.")
125
231
  }),
126
- execute: async ({ keyword }) => trim(await c.instagram.searchUsers({ keyword }), max)
232
+ execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), "users", max)
127
233
  });
128
234
  }
129
235
  function scavioTools(config) {
130
236
  return {
131
237
  scavio_search: scavioSearch(config),
132
238
  scavio_youtube_search: scavioYoutubeSearch(config),
239
+ scavio_youtube_video: scavioYoutubeVideo(config),
240
+ scavio_youtube_transcript: scavioYoutubeTranscript(config),
241
+ scavio_youtube_comments: scavioYoutubeComments(config),
242
+ scavio_youtube_channel: scavioYoutubeChannel(config),
133
243
  scavio_reddit_search: scavioRedditSearch(config),
134
244
  scavio_amazon_search: scavioAmazonSearch(config),
245
+ scavio_amazon_offers: scavioAmazonOffers(config),
135
246
  scavio_walmart_search: scavioWalmartSearch(config),
136
247
  scavio_tiktok_search: scavioTiktokSearch(config),
137
248
  scavio_instagram_search: scavioInstagramSearch(config)
@@ -139,6 +250,7 @@ function scavioTools(config) {
139
250
  }
140
251
  // Annotate the CommonJS export names for ESM import in node:
141
252
  0 && (module.exports = {
253
+ scavioAmazonOffers,
142
254
  scavioAmazonSearch,
143
255
  scavioInstagramSearch,
144
256
  scavioRedditSearch,
@@ -146,6 +258,10 @@ function scavioTools(config) {
146
258
  scavioTiktokSearch,
147
259
  scavioTools,
148
260
  scavioWalmartSearch,
149
- scavioYoutubeSearch
261
+ scavioYoutubeChannel,
262
+ scavioYoutubeComments,
263
+ scavioYoutubeSearch,
264
+ scavioYoutubeTranscript,
265
+ scavioYoutubeVideo
150
266
  });
151
267
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /** Max number of results to keep in `results`-style lists. Defaults to 10. */\n maxResults?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\nfunction trim(res: Record<string, unknown>, max: number): Record<string, unknown> {\n const results = res.results;\n if (Array.isArray(results) && results.length > max) {\n return { ...res, results: results.slice(0, max) };\n }\n return res;\n}\n\n/** Google web search. */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API. Returns real-time organic search results.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n country_code: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter language code, e.g. \"en\".'),\n }),\n execute: async ({ query, country_code, language }) =>\n trim(await c.google.search({ query, country_code, language }), max),\n });\n}\n\n/** YouTube video search. */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search YouTube for videos via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n }),\n execute: async ({ query }) => trim(await c.youtube.search({ query }), max),\n });\n}\n\n/** Reddit post/community search (costs 2 credits). */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Reddit posts and communities via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n sort: z.string().optional().describe(\"Sort order for results.\"),\n }),\n execute: async ({ query, sort }) => trim(await c.reddit.search({ query, sort }), max),\n });\n}\n\n/** Amazon product search. */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Amazon for products via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n domain: z.string().optional().describe('Amazon domain, e.g. \"amazon.com\".'),\n }),\n execute: async ({ query, domain }) => trim(await c.amazon.search({ query, domain }), max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trim(await c.walmart.search({ query }), max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search TikTok for videos by keyword via the Scavio API.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.string().optional().describe(\"Sort order for results.\"),\n publish_time: z.string().optional().describe(\"Filter by publish time window.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trim(await c.tiktok.searchVideos({ keyword, sort_type, publish_time }), max),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Instagram for users by keyword via the Scavio API.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trim(await c.instagram.searchUsers({ keyword }), max),\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,iBAAkB;AAClB,oBAA0C;AAO1C,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,qBAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAEA,SAAS,KAAK,KAA8B,KAAsC;AAChF,QAAM,UAAU,IAAI;AACpB,MAAI,MAAM,QAAQ,OAAO,KAAK,QAAQ,SAAS,KAAK;AAClD,WAAO,EAAE,GAAG,KAAK,SAAS,QAAQ,MAAM,GAAG,GAAG,EAAE;AAAA,EAClD;AACA,SAAO;AACT;AAGO,SAAS,aAAa,QAA2B;AACtD,QAAM,IAAI,OAAO,MAAM;AACv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A,EAC/E,CAAC;AACH;AAGO,SAAS,sBAAsB,QAA2B;AAC/D,QAAM,IAAI,OAAO,MAAM;AACvB,QAAM,MAAM,QAAQ,cAAc;AAClC,aAAO,gBAAK;AAAA,IACV,aAAa;AAAA,IACb,aAAa,aAAE,OAAO;AAAA,MACpB,SAAS,aAAE,OAAO,EAAE,SAAS,qBAAqB;AAAA,IACpD,CAAC;AAAA,IACD,SAAS,OAAO,EAAE,QAAQ,MAAM,KAAK,MAAM,EAAE,UAAU,YAAY,EAAE,QAAQ,CAAC,GAAG,GAAG;AAAA,EACtF,CAAC;AACH;AAMO,SAAS,YAAY,QAA2B;AACrD,SAAO;AAAA,IACL,eAAe,aAAa,MAAM;AAAA,IAClC,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,EACvD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n */\n maxResults?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (8 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (8 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the upstream provider changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (10 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,iBAAkB;AAClB,oBAAoE;AAUpE,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,qBAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAMA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI,GAAG;AACpB,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE;AAAA,EAC7C;AAC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,CAAC,GAAG,SAAS,GAAG;AAAA,EACnG,CAAC;AACH;AAMO,SAAS,YAAY,QAA2B;AACrD,SAAO;AAAA,IACL,eAAe,aAAa,MAAM;AAAA,IAClC,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,2BAA2B,wBAAwB,MAAM;AAAA,IACzD,yBAAyB,sBAAsB,MAAM;AAAA,IACrD,wBAAwB,qBAAqB,MAAM;AAAA,IACnD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,EACvD;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -2,28 +2,76 @@ import * as ai from 'ai';
2
2
  import { ScavioConfig } from 'scavio';
3
3
 
4
4
  interface ScavioToolConfig extends ScavioConfig {
5
- /** Max number of results to keep in `results`-style lists. Defaults to 10. */
5
+ /**
6
+ * Max number of items to keep in the tool's result list. Defaults to 10.
7
+ * Trimmed inside `data` on every platform except Google, whose body is flat.
8
+ */
6
9
  maxResults?: number;
7
10
  }
8
- /** Google web search. */
11
+ /** Google web search (/api/v2/google, 1 credit). */
9
12
  declare function scavioSearch(config?: ScavioToolConfig): ai.Tool<{
10
13
  query: string;
11
- country_code?: string | undefined;
14
+ countryCode?: string | undefined;
12
15
  language?: string | undefined;
16
+ page?: number | undefined;
17
+ device?: "desktop" | "mobile" | undefined;
18
+ nfpr?: boolean | undefined;
13
19
  }, Record<string, unknown>>;
14
- /** YouTube video search. */
20
+ /** YouTube video search (2 credits). */
15
21
  declare function scavioYoutubeSearch(config?: ScavioToolConfig): ai.Tool<{
16
22
  query: string;
23
+ type?: string | undefined;
24
+ upload_date?: string | undefined;
25
+ duration?: string | undefined;
26
+ sort_by?: string | undefined;
27
+ cursor?: string | undefined;
17
28
  }, Record<string, unknown>>;
18
- /** Reddit post/community search (costs 2 credits). */
29
+ /** YouTube video details (1 credit). */
30
+ declare function scavioYoutubeVideo(config?: ScavioToolConfig): ai.Tool<{
31
+ video_id: string;
32
+ }, Record<string, unknown>>;
33
+ /** YouTube video transcript / subtitles (8 credits). */
34
+ declare function scavioYoutubeTranscript(config?: ScavioToolConfig): ai.Tool<{
35
+ video_id: string;
36
+ language?: string | undefined;
37
+ format?: "text" | "srt" | undefined;
38
+ }, Record<string, unknown>>;
39
+ /** YouTube video comments (1 credit). */
40
+ declare function scavioYoutubeComments(config?: ScavioToolConfig): ai.Tool<{
41
+ video_id: string;
42
+ cursor?: string | undefined;
43
+ }, Record<string, unknown>>;
44
+ /** YouTube channel details (1 credit). */
45
+ declare function scavioYoutubeChannel(config?: ScavioToolConfig): ai.Tool<{
46
+ channel_id: string;
47
+ }, Record<string, unknown>>;
48
+ /**
49
+ * Reddit post search (1 credit).
50
+ *
51
+ * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or
52
+ * filter by type, so no such input is offered. The API silently ignores those
53
+ * params, which would leave a model believing it had filtered when it had not.
54
+ */
19
55
  declare function scavioRedditSearch(config?: ScavioToolConfig): ai.Tool<{
20
56
  query: string;
21
- sort?: string | undefined;
57
+ cursor?: string | undefined;
22
58
  }, Record<string, unknown>>;
23
- /** Amazon product search. */
59
+ /**
60
+ * Amazon product search.
61
+ *
62
+ * `domain` was dropped in favour of `country`, a two-letter marketplace code -
63
+ * the upstream provider changed in 2026-07 and no longer takes a domain
64
+ * suffix. It still works on the wire as a deprecated alias, but a model should
65
+ * only ever see one spelling of a param.
66
+ */
24
67
  declare function scavioAmazonSearch(config?: ScavioToolConfig): ai.Tool<{
25
68
  query: string;
26
- domain?: string | undefined;
69
+ country?: string | undefined;
70
+ }, Record<string, unknown>>;
71
+ /** Every seller offer for one Amazon ASIN. */
72
+ declare function scavioAmazonOffers(config?: ScavioToolConfig): ai.Tool<{
73
+ asin: string;
74
+ country?: string | undefined;
27
75
  }, Record<string, unknown>>;
28
76
  /** Walmart product search. */
29
77
  declare function scavioWalmartSearch(config?: ScavioToolConfig): ai.Tool<{
@@ -32,8 +80,8 @@ declare function scavioWalmartSearch(config?: ScavioToolConfig): ai.Tool<{
32
80
  /** TikTok video search. */
33
81
  declare function scavioTiktokSearch(config?: ScavioToolConfig): ai.Tool<{
34
82
  keyword: string;
35
- sort_type?: string | undefined;
36
- publish_time?: string | undefined;
83
+ sort_type?: "0" | "1" | undefined;
84
+ publish_time?: "0" | "1" | "7" | "30" | "90" | "180" | undefined;
37
85
  }, Record<string, unknown>>;
38
86
  /** Instagram user search. */
39
87
  declare function scavioInstagramSearch(config?: ScavioToolConfig): ai.Tool<{
@@ -46,31 +94,58 @@ declare function scavioInstagramSearch(config?: ScavioToolConfig): ai.Tool<{
46
94
  declare function scavioTools(config?: ScavioToolConfig): {
47
95
  scavio_search: ai.Tool<{
48
96
  query: string;
49
- country_code?: string | undefined;
97
+ countryCode?: string | undefined;
50
98
  language?: string | undefined;
99
+ page?: number | undefined;
100
+ device?: "desktop" | "mobile" | undefined;
101
+ nfpr?: boolean | undefined;
51
102
  }, Record<string, unknown>>;
52
103
  scavio_youtube_search: ai.Tool<{
53
104
  query: string;
105
+ type?: string | undefined;
106
+ upload_date?: string | undefined;
107
+ duration?: string | undefined;
108
+ sort_by?: string | undefined;
109
+ cursor?: string | undefined;
110
+ }, Record<string, unknown>>;
111
+ scavio_youtube_video: ai.Tool<{
112
+ video_id: string;
113
+ }, Record<string, unknown>>;
114
+ scavio_youtube_transcript: ai.Tool<{
115
+ video_id: string;
116
+ language?: string | undefined;
117
+ format?: "text" | "srt" | undefined;
118
+ }, Record<string, unknown>>;
119
+ scavio_youtube_comments: ai.Tool<{
120
+ video_id: string;
121
+ cursor?: string | undefined;
122
+ }, Record<string, unknown>>;
123
+ scavio_youtube_channel: ai.Tool<{
124
+ channel_id: string;
54
125
  }, Record<string, unknown>>;
55
126
  scavio_reddit_search: ai.Tool<{
56
127
  query: string;
57
- sort?: string | undefined;
128
+ cursor?: string | undefined;
58
129
  }, Record<string, unknown>>;
59
130
  scavio_amazon_search: ai.Tool<{
60
131
  query: string;
61
- domain?: string | undefined;
132
+ country?: string | undefined;
133
+ }, Record<string, unknown>>;
134
+ scavio_amazon_offers: ai.Tool<{
135
+ asin: string;
136
+ country?: string | undefined;
62
137
  }, Record<string, unknown>>;
63
138
  scavio_walmart_search: ai.Tool<{
64
139
  query: string;
65
140
  }, Record<string, unknown>>;
66
141
  scavio_tiktok_search: ai.Tool<{
67
142
  keyword: string;
68
- sort_type?: string | undefined;
69
- publish_time?: string | undefined;
143
+ sort_type?: "0" | "1" | undefined;
144
+ publish_time?: "0" | "1" | "7" | "30" | "90" | "180" | undefined;
70
145
  }, Record<string, unknown>>;
71
146
  scavio_instagram_search: ai.Tool<{
72
147
  keyword: string;
73
148
  }, Record<string, unknown>>;
74
149
  };
75
150
 
76
- export { type ScavioToolConfig, scavioAmazonSearch, scavioInstagramSearch, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeSearch };
151
+ export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioInstagramSearch, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
package/dist/index.d.ts CHANGED
@@ -2,28 +2,76 @@ import * as ai from 'ai';
2
2
  import { ScavioConfig } from 'scavio';
3
3
 
4
4
  interface ScavioToolConfig extends ScavioConfig {
5
- /** Max number of results to keep in `results`-style lists. Defaults to 10. */
5
+ /**
6
+ * Max number of items to keep in the tool's result list. Defaults to 10.
7
+ * Trimmed inside `data` on every platform except Google, whose body is flat.
8
+ */
6
9
  maxResults?: number;
7
10
  }
8
- /** Google web search. */
11
+ /** Google web search (/api/v2/google, 1 credit). */
9
12
  declare function scavioSearch(config?: ScavioToolConfig): ai.Tool<{
10
13
  query: string;
11
- country_code?: string | undefined;
14
+ countryCode?: string | undefined;
12
15
  language?: string | undefined;
16
+ page?: number | undefined;
17
+ device?: "desktop" | "mobile" | undefined;
18
+ nfpr?: boolean | undefined;
13
19
  }, Record<string, unknown>>;
14
- /** YouTube video search. */
20
+ /** YouTube video search (2 credits). */
15
21
  declare function scavioYoutubeSearch(config?: ScavioToolConfig): ai.Tool<{
16
22
  query: string;
23
+ type?: string | undefined;
24
+ upload_date?: string | undefined;
25
+ duration?: string | undefined;
26
+ sort_by?: string | undefined;
27
+ cursor?: string | undefined;
17
28
  }, Record<string, unknown>>;
18
- /** Reddit post/community search (costs 2 credits). */
29
+ /** YouTube video details (1 credit). */
30
+ declare function scavioYoutubeVideo(config?: ScavioToolConfig): ai.Tool<{
31
+ video_id: string;
32
+ }, Record<string, unknown>>;
33
+ /** YouTube video transcript / subtitles (8 credits). */
34
+ declare function scavioYoutubeTranscript(config?: ScavioToolConfig): ai.Tool<{
35
+ video_id: string;
36
+ language?: string | undefined;
37
+ format?: "text" | "srt" | undefined;
38
+ }, Record<string, unknown>>;
39
+ /** YouTube video comments (1 credit). */
40
+ declare function scavioYoutubeComments(config?: ScavioToolConfig): ai.Tool<{
41
+ video_id: string;
42
+ cursor?: string | undefined;
43
+ }, Record<string, unknown>>;
44
+ /** YouTube channel details (1 credit). */
45
+ declare function scavioYoutubeChannel(config?: ScavioToolConfig): ai.Tool<{
46
+ channel_id: string;
47
+ }, Record<string, unknown>>;
48
+ /**
49
+ * Reddit post search (1 credit).
50
+ *
51
+ * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or
52
+ * filter by type, so no such input is offered. The API silently ignores those
53
+ * params, which would leave a model believing it had filtered when it had not.
54
+ */
19
55
  declare function scavioRedditSearch(config?: ScavioToolConfig): ai.Tool<{
20
56
  query: string;
21
- sort?: string | undefined;
57
+ cursor?: string | undefined;
22
58
  }, Record<string, unknown>>;
23
- /** Amazon product search. */
59
+ /**
60
+ * Amazon product search.
61
+ *
62
+ * `domain` was dropped in favour of `country`, a two-letter marketplace code -
63
+ * the upstream provider changed in 2026-07 and no longer takes a domain
64
+ * suffix. It still works on the wire as a deprecated alias, but a model should
65
+ * only ever see one spelling of a param.
66
+ */
24
67
  declare function scavioAmazonSearch(config?: ScavioToolConfig): ai.Tool<{
25
68
  query: string;
26
- domain?: string | undefined;
69
+ country?: string | undefined;
70
+ }, Record<string, unknown>>;
71
+ /** Every seller offer for one Amazon ASIN. */
72
+ declare function scavioAmazonOffers(config?: ScavioToolConfig): ai.Tool<{
73
+ asin: string;
74
+ country?: string | undefined;
27
75
  }, Record<string, unknown>>;
28
76
  /** Walmart product search. */
29
77
  declare function scavioWalmartSearch(config?: ScavioToolConfig): ai.Tool<{
@@ -32,8 +80,8 @@ declare function scavioWalmartSearch(config?: ScavioToolConfig): ai.Tool<{
32
80
  /** TikTok video search. */
33
81
  declare function scavioTiktokSearch(config?: ScavioToolConfig): ai.Tool<{
34
82
  keyword: string;
35
- sort_type?: string | undefined;
36
- publish_time?: string | undefined;
83
+ sort_type?: "0" | "1" | undefined;
84
+ publish_time?: "0" | "1" | "7" | "30" | "90" | "180" | undefined;
37
85
  }, Record<string, unknown>>;
38
86
  /** Instagram user search. */
39
87
  declare function scavioInstagramSearch(config?: ScavioToolConfig): ai.Tool<{
@@ -46,31 +94,58 @@ declare function scavioInstagramSearch(config?: ScavioToolConfig): ai.Tool<{
46
94
  declare function scavioTools(config?: ScavioToolConfig): {
47
95
  scavio_search: ai.Tool<{
48
96
  query: string;
49
- country_code?: string | undefined;
97
+ countryCode?: string | undefined;
50
98
  language?: string | undefined;
99
+ page?: number | undefined;
100
+ device?: "desktop" | "mobile" | undefined;
101
+ nfpr?: boolean | undefined;
51
102
  }, Record<string, unknown>>;
52
103
  scavio_youtube_search: ai.Tool<{
53
104
  query: string;
105
+ type?: string | undefined;
106
+ upload_date?: string | undefined;
107
+ duration?: string | undefined;
108
+ sort_by?: string | undefined;
109
+ cursor?: string | undefined;
110
+ }, Record<string, unknown>>;
111
+ scavio_youtube_video: ai.Tool<{
112
+ video_id: string;
113
+ }, Record<string, unknown>>;
114
+ scavio_youtube_transcript: ai.Tool<{
115
+ video_id: string;
116
+ language?: string | undefined;
117
+ format?: "text" | "srt" | undefined;
118
+ }, Record<string, unknown>>;
119
+ scavio_youtube_comments: ai.Tool<{
120
+ video_id: string;
121
+ cursor?: string | undefined;
122
+ }, Record<string, unknown>>;
123
+ scavio_youtube_channel: ai.Tool<{
124
+ channel_id: string;
54
125
  }, Record<string, unknown>>;
55
126
  scavio_reddit_search: ai.Tool<{
56
127
  query: string;
57
- sort?: string | undefined;
128
+ cursor?: string | undefined;
58
129
  }, Record<string, unknown>>;
59
130
  scavio_amazon_search: ai.Tool<{
60
131
  query: string;
61
- domain?: string | undefined;
132
+ country?: string | undefined;
133
+ }, Record<string, unknown>>;
134
+ scavio_amazon_offers: ai.Tool<{
135
+ asin: string;
136
+ country?: string | undefined;
62
137
  }, Record<string, unknown>>;
63
138
  scavio_walmart_search: ai.Tool<{
64
139
  query: string;
65
140
  }, Record<string, unknown>>;
66
141
  scavio_tiktok_search: ai.Tool<{
67
142
  keyword: string;
68
- sort_type?: string | undefined;
69
- publish_time?: string | undefined;
143
+ sort_type?: "0" | "1" | undefined;
144
+ publish_time?: "0" | "1" | "7" | "30" | "90" | "180" | undefined;
70
145
  }, Record<string, unknown>>;
71
146
  scavio_instagram_search: ai.Tool<{
72
147
  keyword: string;
73
148
  }, Record<string, unknown>>;
74
149
  };
75
150
 
76
- export { type ScavioToolConfig, scavioAmazonSearch, scavioInstagramSearch, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeSearch };
151
+ export { type ScavioToolConfig, scavioAmazonOffers, scavioAmazonSearch, scavioInstagramSearch, scavioRedditSearch, scavioSearch, scavioTiktokSearch, scavioTools, scavioWalmartSearch, scavioYoutubeChannel, scavioYoutubeComments, scavioYoutubeSearch, scavioYoutubeTranscript, scavioYoutubeVideo };
package/dist/index.js CHANGED
@@ -5,10 +5,19 @@ import { Scavio } from "scavio";
5
5
  function client(config) {
6
6
  return new Scavio({ apiKey: config?.apiKey });
7
7
  }
8
- function trim(res, max) {
9
- const results = res.results;
10
- if (Array.isArray(results) && results.length > max) {
11
- return { ...res, results: results.slice(0, max) };
8
+ function trimFlat(res, key, max) {
9
+ const list = res[key];
10
+ if (Array.isArray(list) && list.length > max) {
11
+ return { ...res, [key]: list.slice(0, max) };
12
+ }
13
+ return res;
14
+ }
15
+ function trimData(res, key, max) {
16
+ const data = res.data;
17
+ if (!data || typeof data !== "object") return res;
18
+ const list = data[key];
19
+ if (Array.isArray(list) && list.length > max) {
20
+ return { ...res, data: { ...data, [key]: list.slice(0, max) } };
12
21
  }
13
22
  return res;
14
23
  }
@@ -16,97 +25,195 @@ function scavioSearch(config) {
16
25
  const c = client(config);
17
26
  const max = config?.maxResults ?? 10;
18
27
  return tool({
19
- description: "Search the web with Google via the Scavio API. Returns real-time organic search results.",
28
+ description: "Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.",
20
29
  inputSchema: z.object({
21
30
  query: z.string().describe("The search query."),
22
- country_code: z.string().optional().describe('Two-letter country code to localize results, e.g. "us".'),
23
- language: z.string().optional().describe('Two-letter language code, e.g. "en".')
31
+ countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. "us".'),
32
+ language: z.string().optional().describe('Two-letter UI language code, e.g. "en".'),
33
+ page: z.number().int().optional().describe("1-based result page; page 2 starts at result 10."),
34
+ device: z.enum(["desktop", "mobile"]).optional().describe("Device to emulate."),
35
+ nfpr: z.boolean().optional().describe("Disable spelling auto-correction / similar-result substitution when true.")
24
36
  }),
25
- execute: async ({ query, country_code, language }) => trim(await c.google.search({ query, country_code, language }), max)
37
+ execute: async ({ query, countryCode, language, page, device, nfpr }) => {
38
+ const params = { query };
39
+ if (countryCode) params.gl = countryCode;
40
+ if (language) params.hl = language;
41
+ if (page && page > 1) params.start = (page - 1) * 10;
42
+ if (device) params.device = device;
43
+ if (nfpr !== void 0) params.nfpr = nfpr;
44
+ return trimFlat(await c.google.search(params), "organic_results", max);
45
+ }
26
46
  });
27
47
  }
28
48
  function scavioYoutubeSearch(config) {
29
49
  const c = client(config);
30
50
  const max = config?.maxResults ?? 10;
31
51
  return tool({
32
- description: "Search YouTube for videos via the Scavio API.",
52
+ description: "Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.",
53
+ inputSchema: z.object({
54
+ query: z.string().describe("The search query."),
55
+ upload_date: z.string().optional().describe("Upload date filter, e.g. 'today', 'this_week', 'this_month'."),
56
+ type: z.string().optional().describe("Result type: 'video', 'channel', 'playlist', 'movie'."),
57
+ duration: z.string().optional().describe("Duration filter: 'short', 'medium', 'long'."),
58
+ sort_by: z.string().optional().describe("Sort order: 'relevance', 'date', 'view_count', 'rating'."),
59
+ cursor: z.string().optional().describe("Pagination cursor (`next_cursor`) from a prior response.")
60
+ }),
61
+ execute: async ({ query, upload_date, type, duration, sort_by, cursor }) => trimData(
62
+ await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor }),
63
+ "results",
64
+ max
65
+ )
66
+ });
67
+ }
68
+ function scavioYoutubeVideo(config) {
69
+ const c = client(config);
70
+ return tool({
71
+ description: "Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.",
72
+ inputSchema: z.object({
73
+ video_id: z.string().describe("YouTube video id or a full watch URL.")
74
+ }),
75
+ execute: async ({ video_id }) => c.youtube.video({ video_id })
76
+ });
77
+ }
78
+ function scavioYoutubeTranscript(config) {
79
+ const c = client(config);
80
+ return tool({
81
+ description: "Fetch a YouTube video's transcript or timed subtitles via the Scavio API (8 credits).",
82
+ inputSchema: z.object({
83
+ video_id: z.string().describe("YouTube video id or a full watch URL."),
84
+ language: z.string().optional().describe("Transcript language code (default 'en')."),
85
+ format: z.enum(["text", "srt"]).optional().describe("'text' for a plain transcript, 'srt' for timed subtitles.")
86
+ }),
87
+ execute: async ({ video_id, language, format }) => c.youtube.transcript({ video_id, language, format })
88
+ });
89
+ }
90
+ function scavioYoutubeComments(config) {
91
+ const c = client(config);
92
+ const max = config?.maxResults ?? 10;
93
+ return tool({
94
+ description: "List comments on a YouTube video via the Scavio API.",
95
+ inputSchema: z.object({
96
+ video_id: z.string().describe("YouTube video id or a full watch URL."),
97
+ cursor: z.string().optional().describe("Pagination cursor.")
98
+ }),
99
+ execute: async ({ video_id, cursor }) => trimData(
100
+ await c.youtube.comments({ video_id, cursor }),
101
+ "comments",
102
+ max
103
+ )
104
+ });
105
+ }
106
+ function scavioYoutubeChannel(config) {
107
+ const c = client(config);
108
+ return tool({
109
+ description: "Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.",
33
110
  inputSchema: z.object({
34
- query: z.string().describe("The search query.")
111
+ channel_id: z.string().describe("YouTube channel id, @handle, or channel URL.")
35
112
  }),
36
- execute: async ({ query }) => trim(await c.youtube.search({ query }), max)
113
+ execute: async ({ channel_id }) => c.youtube.channel({ channel_id })
37
114
  });
38
115
  }
39
116
  function scavioRedditSearch(config) {
40
117
  const c = client(config);
41
118
  const max = config?.maxResults ?? 10;
42
119
  return tool({
43
- description: "Search Reddit posts and communities via the Scavio API.",
120
+ description: "Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.",
44
121
  inputSchema: z.object({
45
122
  query: z.string().describe("The search query."),
46
- sort: z.string().optional().describe("Sort order for results.")
123
+ cursor: z.string().optional().describe("Pagination cursor (`next_cursor`) from a prior response.")
47
124
  }),
48
- execute: async ({ query, sort }) => trim(await c.reddit.search({ query, sort }), max)
125
+ execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), "results", max)
49
126
  });
50
127
  }
51
128
  function scavioAmazonSearch(config) {
52
129
  const c = client(config);
53
130
  const max = config?.maxResults ?? 10;
54
131
  return tool({
55
- description: "Search Amazon for products via the Scavio API.",
132
+ description: "Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.",
56
133
  inputSchema: z.object({
57
134
  query: z.string().describe("The product search query."),
58
- domain: z.string().optional().describe('Amazon domain, e.g. "amazon.com".')
135
+ country: z.string().optional().describe(
136
+ "Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us."
137
+ )
138
+ }),
139
+ execute: async ({ query, country }) => trimData(await c.amazon.search({ query, country }), "products", max)
140
+ });
141
+ }
142
+ function scavioAmazonOffers(config) {
143
+ const c = client(config);
144
+ const max = config?.maxResults ?? 10;
145
+ return tool({
146
+ description: "List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.",
147
+ inputSchema: z.object({
148
+ asin: z.string().describe("Amazon Standard Identification Number (ASIN) of the product."),
149
+ country: z.string().optional().describe(
150
+ "Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us."
151
+ )
59
152
  }),
60
- execute: async ({ query, domain }) => trim(await c.amazon.search({ query, domain }), max)
153
+ execute: async ({ asin, country }) => trimData(await c.amazon.offers({ asin, country }), "offers", max)
61
154
  });
62
155
  }
63
156
  function scavioWalmartSearch(config) {
64
157
  const c = client(config);
65
158
  const max = config?.maxResults ?? 10;
66
159
  return tool({
67
- description: "Search Walmart for products via the Scavio API.",
160
+ description: "Search Walmart for products via the Scavio API. Products come back under `data.products`.",
68
161
  inputSchema: z.object({
69
162
  query: z.string().describe("The product search query.")
70
163
  }),
71
- execute: async ({ query }) => trim(await c.walmart.search({ query }), max)
164
+ execute: async ({ query }) => trimData(await c.walmart.search({ query }), "products", max)
72
165
  });
73
166
  }
74
167
  function scavioTiktokSearch(config) {
75
168
  const c = client(config);
76
169
  const max = config?.maxResults ?? 10;
77
170
  return tool({
78
- description: "Search TikTok for videos by keyword via the Scavio API.",
171
+ description: "Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.",
79
172
  inputSchema: z.object({
80
173
  keyword: z.string().describe("The search keyword."),
81
- sort_type: z.string().optional().describe("Sort order for results."),
82
- publish_time: z.string().optional().describe("Filter by publish time window.")
174
+ sort_type: z.enum(["0", "1"]).optional().describe("Sort order: '0' relevance, '1' most likes."),
175
+ publish_time: z.enum(["0", "1", "7", "30", "90", "180"]).optional().describe("Publish window in days: '0' all time, '1', '7', '30', '90', '180'.")
83
176
  }),
84
- execute: async ({ keyword, sort_type, publish_time }) => trim(await c.tiktok.searchVideos({ keyword, sort_type, publish_time }), max)
177
+ execute: async ({ keyword, sort_type, publish_time }) => trimData(
178
+ await c.tiktok.searchVideos({
179
+ keyword,
180
+ sort_type,
181
+ publish_time
182
+ }),
183
+ "aweme_list",
184
+ max
185
+ )
85
186
  });
86
187
  }
87
188
  function scavioInstagramSearch(config) {
88
189
  const c = client(config);
89
190
  const max = config?.maxResults ?? 10;
90
191
  return tool({
91
- description: "Search Instagram for users by keyword via the Scavio API.",
192
+ description: "Search Instagram for users by keyword via the Scavio API (10 credits). Users come back under `data.users`.",
92
193
  inputSchema: z.object({
93
194
  keyword: z.string().describe("The search keyword.")
94
195
  }),
95
- execute: async ({ keyword }) => trim(await c.instagram.searchUsers({ keyword }), max)
196
+ execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), "users", max)
96
197
  });
97
198
  }
98
199
  function scavioTools(config) {
99
200
  return {
100
201
  scavio_search: scavioSearch(config),
101
202
  scavio_youtube_search: scavioYoutubeSearch(config),
203
+ scavio_youtube_video: scavioYoutubeVideo(config),
204
+ scavio_youtube_transcript: scavioYoutubeTranscript(config),
205
+ scavio_youtube_comments: scavioYoutubeComments(config),
206
+ scavio_youtube_channel: scavioYoutubeChannel(config),
102
207
  scavio_reddit_search: scavioRedditSearch(config),
103
208
  scavio_amazon_search: scavioAmazonSearch(config),
209
+ scavio_amazon_offers: scavioAmazonOffers(config),
104
210
  scavio_walmart_search: scavioWalmartSearch(config),
105
211
  scavio_tiktok_search: scavioTiktokSearch(config),
106
212
  scavio_instagram_search: scavioInstagramSearch(config)
107
213
  };
108
214
  }
109
215
  export {
216
+ scavioAmazonOffers,
110
217
  scavioAmazonSearch,
111
218
  scavioInstagramSearch,
112
219
  scavioRedditSearch,
@@ -114,6 +221,10 @@ export {
114
221
  scavioTiktokSearch,
115
222
  scavioTools,
116
223
  scavioWalmartSearch,
117
- scavioYoutubeSearch
224
+ scavioYoutubeChannel,
225
+ scavioYoutubeComments,
226
+ scavioYoutubeSearch,
227
+ scavioYoutubeTranscript,
228
+ scavioYoutubeVideo
118
229
  };
119
230
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /** Max number of results to keep in `results`-style lists. Defaults to 10. */\n maxResults?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\nfunction trim(res: Record<string, unknown>, max: number): Record<string, unknown> {\n const results = res.results;\n if (Array.isArray(results) && results.length > max) {\n return { ...res, results: results.slice(0, max) };\n }\n return res;\n}\n\n/** Google web search. */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API. Returns real-time organic search results.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n country_code: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter language code, e.g. \"en\".'),\n }),\n execute: async ({ query, country_code, language }) =>\n trim(await c.google.search({ query, country_code, language }), max),\n });\n}\n\n/** YouTube video search. */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search YouTube for videos via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n }),\n execute: async ({ query }) => trim(await c.youtube.search({ query }), max),\n });\n}\n\n/** Reddit post/community search (costs 2 credits). */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Reddit posts and communities via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n sort: z.string().optional().describe(\"Sort order for results.\"),\n }),\n execute: async ({ query, sort }) => trim(await c.reddit.search({ query, sort }), max),\n });\n}\n\n/** Amazon product search. */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Amazon for products via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n domain: z.string().optional().describe('Amazon domain, e.g. \"amazon.com\".'),\n }),\n execute: async ({ query, domain }) => trim(await c.amazon.search({ query, domain }), max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trim(await c.walmart.search({ query }), max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search TikTok for videos by keyword via the Scavio API.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.string().optional().describe(\"Sort order for results.\"),\n publish_time: z.string().optional().describe(\"Filter by publish time window.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trim(await c.tiktok.searchVideos({ keyword, sort_type, publish_time }), max),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Instagram for users by keyword via the Scavio API.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trim(await c.instagram.searchUsers({ keyword }), max),\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n };\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,cAAiC;AAO1C,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,OAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAEA,SAAS,KAAK,KAA8B,KAAsC;AAChF,QAAM,UAAU,IAAI;AACpB,MAAI,MAAM,QAAQ,OAAO,KAAK,QAAQ,SAAS,KAAK;AAClD,WAAO,EAAE,GAAG,KAAK,SAAS,QAAQ,MAAM,GAAG,GAAG,EAAE;AAAA,EAClD;AACA,SAAO;AACT;AAGO,SAAS,aAAa,QAA2B;AACtD,QAAM,IAAI,OAAO,MAAM;AACvB,QAAM,MAAM,QAAQ,cAAc;AAClC,SAAO,KAAK;AAAA,IACV,aACE;AAAA,IACF,aAAa,EAAE,OAAO;AAAA,MACpB,OAAO,EAAE,OAAO,EAAE,SAAS,mBAAmB;AAAA,MAC9C,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,yDAAyD;AAAA,MACtG,UAAU,EAAE,OAAO,EAAE,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,IACD,SAAS,OAAO,EAAE,QAAQ,MAAM,KAAK,MAAM,EAAE,UAAU,YAAY,EAAE,QAAQ,CAAC,GAAG,GAAG;AAAA,EACtF,CAAC;AACH;AAMO,SAAS,YAAY,QAA2B;AACrD,SAAO;AAAA,IACL,eAAe,aAAa,MAAM;AAAA,IAClC,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,EACvD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { tool } from \"ai\";\nimport { z } from \"zod\";\nimport { Scavio, type ScavioConfig, type GoogleSearchOptions } from \"scavio\";\n\nexport interface ScavioToolConfig extends ScavioConfig {\n /**\n * Max number of items to keep in the tool's result list. Defaults to 10.\n * Trimmed inside `data` on every platform except Google, whose body is flat.\n */\n maxResults?: number;\n}\n\nfunction client(config?: ScavioToolConfig): Scavio {\n return new Scavio({ apiKey: config?.apiKey });\n}\n\n/**\n * Google is the ONLY family with a flat body: `organic_results` and friends sit\n * at the top level, next to `response_time` / `credits_used` / `credits_remaining`.\n */\nfunction trimFlat(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const list = res[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, [key]: list.slice(0, max) };\n }\n return res;\n}\n\n/**\n * Every non-Google endpoint nests its payload under `data` - the response is\n * `{ data: { products: [...] }, response_time, credits_used, credits_remaining }`.\n * Trimming the top level is therefore a silent no-op, so those tools trim\n * inside `data`.\n */\nfunction trimData(res: Record<string, unknown>, key: string, max: number): Record<string, unknown> {\n const data = res.data;\n if (!data || typeof data !== \"object\") return res;\n const list = (data as Record<string, unknown>)[key];\n if (Array.isArray(list) && list.length > max) {\n return { ...res, data: { ...(data as Record<string, unknown>), [key]: list.slice(0, max) } };\n }\n return res;\n}\n\n/** Google web search (/api/v2/google, 1 credit). */\nexport function scavioSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search the web with Google via the Scavio API (1 credit). Returns real-time organic search results, each with a title, link, and snippet, under `organic_results`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n countryCode: z.string().optional().describe('Two-letter country code to localize results, e.g. \"us\".'),\n language: z.string().optional().describe('Two-letter UI language code, e.g. \"en\".'),\n page: z.number().int().optional().describe(\"1-based result page; page 2 starts at result 10.\"),\n device: z.enum([\"desktop\", \"mobile\"]).optional().describe(\"Device to emulate.\"),\n nfpr: z.boolean().optional().describe(\"Disable spelling auto-correction / similar-result substitution when true.\"),\n }),\n execute: async ({ query, countryCode, language, page, device, nfpr }) => {\n const params: GoogleSearchOptions = { query };\n if (countryCode) params.gl = countryCode;\n if (language) params.hl = language;\n if (page && page > 1) params.start = (page - 1) * 10;\n if (device) params.device = device;\n if (nfpr !== undefined) params.nfpr = nfpr;\n return trimFlat(await c.google.search(params), \"organic_results\", max);\n },\n });\n}\n\n/** YouTube video search (2 credits). */\nexport function scavioYoutubeSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search YouTube for videos, channels, or playlists via the Scavio API (2 credits). Videos come back under `data.results`, with `data.channels` and `data.playlists` alongside.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n upload_date: z.string().optional().describe(\"Upload date filter, e.g. 'today', 'this_week', 'this_month'.\"),\n type: z.string().optional().describe(\"Result type: 'video', 'channel', 'playlist', 'movie'.\"),\n duration: z.string().optional().describe(\"Duration filter: 'short', 'medium', 'long'.\"),\n sort_by: z.string().optional().describe(\"Sort order: 'relevance', 'date', 'view_count', 'rating'.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, upload_date, type, duration, sort_by, cursor }) =>\n trimData(\n await c.youtube.search({ query, upload_date, type, duration, sort_by, cursor } as Parameters<\n typeof c.youtube.search\n >[0]),\n \"results\",\n max,\n ),\n });\n}\n\n/** YouTube video details (1 credit). */\nexport function scavioYoutubeVideo(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch full details for a YouTube video (title, author, view count, description, captions, chapters) via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n }),\n execute: async ({ video_id }) => c.youtube.video({ video_id }),\n });\n}\n\n/** YouTube video transcript / subtitles (8 credits). */\nexport function scavioYoutubeTranscript(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube video's transcript or timed subtitles via the Scavio API (8 credits).\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n language: z.string().optional().describe(\"Transcript language code (default 'en').\"),\n format: z.enum([\"text\", \"srt\"]).optional().describe(\"'text' for a plain transcript, 'srt' for timed subtitles.\"),\n }),\n execute: async ({ video_id, language, format }) =>\n c.youtube.transcript({ video_id, language, format } as Parameters<typeof c.youtube.transcript>[0]),\n });\n}\n\n/** YouTube video comments (1 credit). */\nexport function scavioYoutubeComments(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"List comments on a YouTube video via the Scavio API.\",\n inputSchema: z.object({\n video_id: z.string().describe(\"YouTube video id or a full watch URL.\"),\n cursor: z.string().optional().describe(\"Pagination cursor.\"),\n }),\n execute: async ({ video_id, cursor }) =>\n trimData(\n await c.youtube.comments({ video_id, cursor } as Parameters<typeof c.youtube.comments>[0]),\n \"comments\",\n max,\n ),\n });\n}\n\n/** YouTube channel details (1 credit). */\nexport function scavioYoutubeChannel(config?: ScavioToolConfig) {\n const c = client(config);\n return tool({\n description:\n \"Fetch a YouTube channel's details (subscribers, video count, views, links) via the Scavio API.\",\n inputSchema: z.object({\n channel_id: z.string().describe(\"YouTube channel id, @handle, or channel URL.\"),\n }),\n execute: async ({ channel_id }) => c.youtube.channel({ channel_id }),\n });\n}\n\n/**\n * Reddit post search (1 credit).\n *\n * The endpoint takes `query` and `cursor` and nothing else - it cannot sort or\n * filter by type, so no such input is offered. The API silently ignores those\n * params, which would leave a model believing it had filtered when it had not.\n */\nexport function scavioRedditSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Reddit posts via the Scavio API (1 credit). Returns matching posts under `data.results` with `data.next_cursor` for the next page. Results cannot be sorted or filtered by type.\",\n inputSchema: z.object({\n query: z.string().describe(\"The search query.\"),\n cursor: z.string().optional().describe(\"Pagination cursor (`next_cursor`) from a prior response.\"),\n }),\n execute: async ({ query, cursor }) => trimData(await c.reddit.search({ query, cursor }), \"results\", max),\n });\n}\n\n/**\n * Amazon product search.\n *\n * `domain` was dropped in favour of `country`, a two-letter marketplace code -\n * the upstream provider changed in 2026-07 and no longer takes a domain\n * suffix. It still works on the wire as a deprecated alias, but a model should\n * only ever see one spelling of a param.\n */\nexport function scavioAmazonSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Amazon for products via the Scavio API. Results are unsorted and cannot be filtered by category, merchant or price.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ query, country }) =>\n trimData(await c.amazon.search({ query, country }), \"products\", max),\n });\n}\n\n/** Every seller offer for one Amazon ASIN. */\nexport function scavioAmazonOffers(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"List every seller offer for one Amazon ASIN via the Scavio API: price, seller, condition, shipping, and which offer holds the buy box. Page 1 only.\",\n inputSchema: z.object({\n asin: z.string().describe(\"Amazon Standard Identification Number (ASIN) of the product.\"),\n country: z\n .string()\n .optional()\n .describe(\n \"Marketplace country code (ISO 3166-1 alpha-2), not a domain: us (default), gb (the UK is gb, not uk), de, fr, jp, ... An unknown code falls back to us.\"\n ),\n }),\n execute: async ({ asin, country }) =>\n trimData(await c.amazon.offers({ asin, country }), \"offers\", max),\n });\n}\n\n/** Walmart product search. */\nexport function scavioWalmartSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description: \"Search Walmart for products via the Scavio API. Products come back under `data.products`.\",\n inputSchema: z.object({\n query: z.string().describe(\"The product search query.\"),\n }),\n execute: async ({ query }) => trimData(await c.walmart.search({ query }), \"products\", max),\n });\n}\n\n/** TikTok video search. */\nexport function scavioTiktokSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search TikTok for videos by keyword via the Scavio API. Videos come back under `data.aweme_list`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n sort_type: z.enum([\"0\", \"1\"]).optional().describe(\"Sort order: '0' relevance, '1' most likes.\"),\n publish_time: z\n .enum([\"0\", \"1\", \"7\", \"30\", \"90\", \"180\"])\n .optional()\n .describe(\"Publish window in days: '0' all time, '1', '7', '30', '90', '180'.\"),\n }),\n execute: async ({ keyword, sort_type, publish_time }) =>\n trimData(\n await c.tiktok.searchVideos({\n keyword,\n sort_type,\n publish_time,\n } as Parameters<typeof c.tiktok.searchVideos>[0]),\n \"aweme_list\",\n max,\n ),\n });\n}\n\n/** Instagram user search. */\nexport function scavioInstagramSearch(config?: ScavioToolConfig) {\n const c = client(config);\n const max = config?.maxResults ?? 10;\n return tool({\n description:\n \"Search Instagram for users by keyword via the Scavio API (10 credits). Users come back under `data.users`.\",\n inputSchema: z.object({\n keyword: z.string().describe(\"The search keyword.\"),\n }),\n execute: async ({ keyword }) => trimData(await c.instagram.searchUsers({ keyword }), \"users\", max),\n });\n}\n\n/**\n * All Scavio tools as an object keyed by tool name, ready to spread into the\n * `tools` option of `generateText` / `streamText`.\n */\nexport function scavioTools(config?: ScavioToolConfig) {\n return {\n scavio_search: scavioSearch(config),\n scavio_youtube_search: scavioYoutubeSearch(config),\n scavio_youtube_video: scavioYoutubeVideo(config),\n scavio_youtube_transcript: scavioYoutubeTranscript(config),\n scavio_youtube_comments: scavioYoutubeComments(config),\n scavio_youtube_channel: scavioYoutubeChannel(config),\n scavio_reddit_search: scavioRedditSearch(config),\n scavio_amazon_search: scavioAmazonSearch(config),\n scavio_amazon_offers: scavioAmazonOffers(config),\n scavio_walmart_search: scavioWalmartSearch(config),\n scavio_tiktok_search: scavioTiktokSearch(config),\n scavio_instagram_search: scavioInstagramSearch(config),\n };\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,cAA2D;AAUpE,SAAS,OAAO,QAAmC;AACjD,SAAO,IAAI,OAAO,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAC9C;AAMA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI,GAAG;AACpB,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE;AAAA,EAC7C;AACA,SAAO;AACT;AAQA,SAAS,SAAS,KAA8B,KAAa,KAAsC;AACjG,QAAM,OAAO,IAAI;AACjB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,QAAM,OAAQ,KAAiC,GAAG;AAClD,MAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,KAAK;AAC5C,WAAO,EAAE,GAAG,KAAK,MAAM,EAAE,GAAI,MAAkC,CAAC,GAAG,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE,EAAE;AAAA,EAC7F;AACA,SAAO;AACT;AAGO,SAA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AAsB,mBAAmB,MAAM;AAAA,IAC/C,uBAAuB,oBAAoB,MAAM;AAAA,IACjD,sBAAsB,mBAAmB,MAAM;AAAA,IAC/C,yBAAyB,sBAAsB,MAAM;AAAA,EACvD;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scavio/ai-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Scavio search tools for the Vercel AI SDK (Google, YouTube, Reddit, Amazon, Walmart, TikTok, Instagram).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -48,12 +48,12 @@
48
48
  "zod": ">=3"
49
49
  },
50
50
  "dependencies": {
51
- "scavio": "^0.2.1"
51
+ "scavio": "^0.13.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@ai-sdk/openai": "^3.0.74",
55
55
  "ai": "^6.0.208",
56
- "scavio": "^0.2.1",
56
+ "scavio": "^0.13.0",
57
57
  "tsup": "^8.0.0",
58
58
  "typescript": "^5.4.0",
59
59
  "vitest": "^2.0.0",