@mastra/tavily 1.1.1 → 1.1.2-alpha.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/LICENSE.md +6 -4
- package/dist/crawl.d.ts +1 -1
- package/dist/extract.d.ts +1 -1
- package/dist/index.cjs +256 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +255 -258
- package/dist/index.js.map +1 -1
- package/dist/search.d.ts +9 -9
- package/dist/tools.d.ts +11 -11
- package/dist/tools.d.ts.map +1 -1
- package/package.json +10 -10
- package/CHANGELOG.md +0 -152
package/LICENSE.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Portions of this software are licensed as follows:
|
|
2
2
|
|
|
3
|
-
- All content that resides under any directory named
|
|
3
|
+
- All content that resides under any directory named `ee/` within this
|
|
4
4
|
repository, including but not limited to:
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
|
|
5
|
+
- `@mastra/core/auth/ee`
|
|
6
|
+
- `@mastra/core/agent-builder/ee`
|
|
7
|
+
- `@mastra/editor/ee`
|
|
8
|
+
|
|
9
|
+
is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
|
|
8
10
|
|
|
9
11
|
- All third-party components incorporated into the Mastra Software are
|
|
10
12
|
licensed under the original license provided by the owner of the
|
package/dist/crawl.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function createTavilyCrawlTool(config?: TavilyClientOptions): imp
|
|
|
10
10
|
excludePaths?: string[] | undefined;
|
|
11
11
|
excludeDomains?: string[] | undefined;
|
|
12
12
|
allowExternal?: boolean | undefined;
|
|
13
|
-
extractDepth?: "
|
|
13
|
+
extractDepth?: "advanced" | "basic" | undefined;
|
|
14
14
|
includeImages?: boolean | undefined;
|
|
15
15
|
format?: "markdown" | "text" | undefined;
|
|
16
16
|
}, {
|
package/dist/extract.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TavilyClientOptions } from './client.js';
|
|
2
2
|
export declare function createTavilyExtractTool(config?: TavilyClientOptions): import("@mastra/core/tools").Tool<{
|
|
3
3
|
urls: string[];
|
|
4
|
-
extractDepth?: "
|
|
4
|
+
extractDepth?: "advanced" | "basic" | undefined;
|
|
5
5
|
query?: string | undefined;
|
|
6
6
|
includeImages?: boolean | undefined;
|
|
7
7
|
format?: "markdown" | "text" | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -1,287 +1,283 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// src/client.ts
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _tavily_core = require("@tavily/core");
|
|
3
|
+
let _mastra_core_tools = require("@mastra/core/tools");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
//#region src/client.ts
|
|
8
6
|
function getTavilyClient(config) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const apiKey = config?.apiKey ?? process.env.TAVILY_API_KEY;
|
|
8
|
+
if (!apiKey) throw new Error("Tavily API key is required. Pass { apiKey } or set TAVILY_API_KEY env var.");
|
|
9
|
+
return (0, _tavily_core.tavily)({
|
|
10
|
+
...config,
|
|
11
|
+
apiKey,
|
|
12
|
+
clientName: config?.clientName ?? "mastra"
|
|
13
|
+
});
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/search.ts
|
|
17
|
+
const inputSchema$3 = zod.z.object({
|
|
18
|
+
query: zod.z.string().describe("The search query"),
|
|
19
|
+
searchDepth: zod.z.enum([
|
|
20
|
+
"basic",
|
|
21
|
+
"advanced",
|
|
22
|
+
"fast",
|
|
23
|
+
"ultra-fast"
|
|
24
|
+
]).optional().describe("Search depth — 'basic' for standard, 'advanced' for thorough, 'fast'/'ultra-fast' for low latency"),
|
|
25
|
+
maxResults: zod.z.number().min(1).max(20).optional().describe("Maximum number of results to return (1-20)"),
|
|
26
|
+
includeAnswer: zod.z.union([zod.z.boolean(), zod.z.enum(["basic", "advanced"])]).optional().describe("Include an AI-generated answer summary. Pass true, \"basic\", or \"advanced\""),
|
|
27
|
+
includeImages: zod.z.boolean().optional().describe("Include query-related images in the response"),
|
|
28
|
+
includeImageDescriptions: zod.z.boolean().optional().describe("Include descriptions for returned images"),
|
|
29
|
+
includeRawContent: zod.z.union([zod.z.literal(false), zod.z.enum(["markdown", "text"])]).optional().describe("Include cleaned HTML content of each result. Pass false to disable, or \"markdown\"/\"text\" for format"),
|
|
30
|
+
includeDomains: zod.z.array(zod.z.string()).optional().describe("Restrict results to these domains"),
|
|
31
|
+
excludeDomains: zod.z.array(zod.z.string()).optional().describe("Exclude results from these domains"),
|
|
32
|
+
timeRange: zod.z.enum([
|
|
33
|
+
"day",
|
|
34
|
+
"week",
|
|
35
|
+
"month",
|
|
36
|
+
"year"
|
|
37
|
+
]).optional().describe("Time range to filter results by recency")
|
|
26
38
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
rawContent: zod.z.string().optional()
|
|
43
|
-
})
|
|
44
|
-
),
|
|
45
|
-
responseTime: zod.z.number()
|
|
39
|
+
const outputSchema$3 = zod.z.object({
|
|
40
|
+
query: zod.z.string(),
|
|
41
|
+
answer: zod.z.string().optional(),
|
|
42
|
+
images: zod.z.array(zod.z.object({
|
|
43
|
+
url: zod.z.string(),
|
|
44
|
+
description: zod.z.string().optional()
|
|
45
|
+
})).optional(),
|
|
46
|
+
results: zod.z.array(zod.z.object({
|
|
47
|
+
title: zod.z.string(),
|
|
48
|
+
url: zod.z.string(),
|
|
49
|
+
content: zod.z.string(),
|
|
50
|
+
score: zod.z.number(),
|
|
51
|
+
rawContent: zod.z.string().optional()
|
|
52
|
+
})),
|
|
53
|
+
responseTime: zod.z.number()
|
|
46
54
|
});
|
|
47
55
|
function createTavilySearchTool(config) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
});
|
|
56
|
+
let client = null;
|
|
57
|
+
function getClient() {
|
|
58
|
+
if (!client) client = getTavilyClient(config);
|
|
59
|
+
return client;
|
|
60
|
+
}
|
|
61
|
+
return (0, _mastra_core_tools.createTool)({
|
|
62
|
+
id: "tavily-search",
|
|
63
|
+
description: "Search the web using Tavily. Returns relevant results with content snippets, optional AI-generated answers, and images. Supports filtering by domain, time range, and search depth.",
|
|
64
|
+
inputSchema: inputSchema$3,
|
|
65
|
+
outputSchema: outputSchema$3,
|
|
66
|
+
execute: async (input) => {
|
|
67
|
+
const response = await getClient().search(input.query, {
|
|
68
|
+
searchDepth: input.searchDepth,
|
|
69
|
+
maxResults: input.maxResults,
|
|
70
|
+
includeAnswer: input.includeAnswer,
|
|
71
|
+
includeImages: input.includeImages,
|
|
72
|
+
includeImageDescriptions: input.includeImageDescriptions,
|
|
73
|
+
includeRawContent: input.includeRawContent,
|
|
74
|
+
includeDomains: input.includeDomains,
|
|
75
|
+
excludeDomains: input.excludeDomains,
|
|
76
|
+
timeRange: input.timeRange
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
query: response.query,
|
|
80
|
+
answer: response.answer || void 0,
|
|
81
|
+
images: response.images?.map((img) => ({
|
|
82
|
+
url: typeof img === "string" ? img : img.url,
|
|
83
|
+
description: typeof img === "string" ? void 0 : img.description
|
|
84
|
+
})),
|
|
85
|
+
results: (response.results ?? []).map((r) => ({
|
|
86
|
+
title: r.title,
|
|
87
|
+
url: r.url,
|
|
88
|
+
content: r.content,
|
|
89
|
+
score: r.score ?? 0,
|
|
90
|
+
rawContent: r.rawContent || void 0
|
|
91
|
+
})),
|
|
92
|
+
responseTime: response.responseTime
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/extract.ts
|
|
99
|
+
const inputSchema$2 = zod.z.object({
|
|
100
|
+
urls: zod.z.array(zod.z.string()).min(1).max(20).describe("URLs to extract content from (1-20)"),
|
|
101
|
+
extractDepth: zod.z.enum(["basic", "advanced"]).optional().describe("Extraction depth — 'advanced' retrieves more data including tables and embedded content"),
|
|
102
|
+
query: zod.z.string().optional().describe("User intent for reranking extracted content chunks. When provided, chunks are reranked based on relevance to this query."),
|
|
103
|
+
includeImages: zod.z.boolean().optional().describe("Include images extracted from the pages"),
|
|
104
|
+
format: zod.z.enum(["markdown", "text"]).optional().describe("Output format for extracted content — 'markdown' (default) or 'text'")
|
|
98
105
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
error: zod.z.string()
|
|
111
|
-
})
|
|
112
|
-
),
|
|
113
|
-
responseTime: zod.z.number()
|
|
106
|
+
const outputSchema$2 = zod.z.object({
|
|
107
|
+
results: zod.z.array(zod.z.object({
|
|
108
|
+
url: zod.z.string(),
|
|
109
|
+
rawContent: zod.z.string(),
|
|
110
|
+
images: zod.z.array(zod.z.string()).optional()
|
|
111
|
+
})),
|
|
112
|
+
failedResults: zod.z.array(zod.z.object({
|
|
113
|
+
url: zod.z.string(),
|
|
114
|
+
error: zod.z.string()
|
|
115
|
+
})),
|
|
116
|
+
responseTime: zod.z.number()
|
|
114
117
|
});
|
|
115
118
|
function createTavilyExtractTool(config) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
});
|
|
119
|
+
let client = null;
|
|
120
|
+
function getClient() {
|
|
121
|
+
if (!client) client = getTavilyClient(config);
|
|
122
|
+
return client;
|
|
123
|
+
}
|
|
124
|
+
return (0, _mastra_core_tools.createTool)({
|
|
125
|
+
id: "tavily-extract",
|
|
126
|
+
description: "Extract content from one or more URLs using Tavily. Returns raw page content in markdown or text format. Supports up to 20 URLs per request with basic or advanced extraction depth.",
|
|
127
|
+
inputSchema: inputSchema$2,
|
|
128
|
+
outputSchema: outputSchema$2,
|
|
129
|
+
execute: async (input) => {
|
|
130
|
+
const response = await getClient().extract(input.urls, {
|
|
131
|
+
extractDepth: input.extractDepth,
|
|
132
|
+
query: input.query,
|
|
133
|
+
includeImages: input.includeImages,
|
|
134
|
+
format: input.format
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
results: (response.results || []).map((r) => ({
|
|
138
|
+
url: r.url,
|
|
139
|
+
rawContent: r.rawContent,
|
|
140
|
+
images: r.images || void 0
|
|
141
|
+
})),
|
|
142
|
+
failedResults: (response.failedResults || []).map((r) => ({
|
|
143
|
+
url: r.url,
|
|
144
|
+
error: r.error
|
|
145
|
+
})),
|
|
146
|
+
responseTime: response.responseTime
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/crawl.ts
|
|
153
|
+
const inputSchema$1 = zod.z.object({
|
|
154
|
+
url: zod.z.string().describe("The root URL to begin the crawl"),
|
|
155
|
+
maxDepth: zod.z.number().optional().describe("Max depth of the crawl from the base URL"),
|
|
156
|
+
maxBreadth: zod.z.number().optional().describe("Max number of links to follow per page"),
|
|
157
|
+
limit: zod.z.number().optional().describe("Total number of pages the crawler will process before stopping"),
|
|
158
|
+
instructions: zod.z.string().optional().describe("Natural language instructions for the crawler"),
|
|
159
|
+
selectPaths: zod.z.array(zod.z.string()).optional().describe("Regex patterns to select specific URL paths"),
|
|
160
|
+
selectDomains: zod.z.array(zod.z.string()).optional().describe("Regex patterns to restrict to specific domains"),
|
|
161
|
+
excludePaths: zod.z.array(zod.z.string()).optional().describe("Regex patterns to exclude specific URL paths"),
|
|
162
|
+
excludeDomains: zod.z.array(zod.z.string()).optional().describe("Regex patterns to exclude specific domains"),
|
|
163
|
+
allowExternal: zod.z.boolean().optional().describe("Whether to follow links to external domains"),
|
|
164
|
+
extractDepth: zod.z.enum(["basic", "advanced"]).optional().describe("Extraction depth — 'advanced' retrieves more data including tables and embedded content"),
|
|
165
|
+
includeImages: zod.z.boolean().optional().describe("Include images from crawled pages"),
|
|
166
|
+
format: zod.z.enum(["markdown", "text"]).optional().describe("Output format for extracted content — 'markdown' (default) or 'text'")
|
|
165
167
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
),
|
|
175
|
-
responseTime: zod.z.number()
|
|
168
|
+
const outputSchema$1 = zod.z.object({
|
|
169
|
+
baseUrl: zod.z.string(),
|
|
170
|
+
results: zod.z.array(zod.z.object({
|
|
171
|
+
url: zod.z.string(),
|
|
172
|
+
rawContent: zod.z.string(),
|
|
173
|
+
images: zod.z.array(zod.z.string()).optional()
|
|
174
|
+
})),
|
|
175
|
+
responseTime: zod.z.number()
|
|
176
176
|
});
|
|
177
177
|
function createTavilyCrawlTool(config) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
});
|
|
178
|
+
let client = null;
|
|
179
|
+
function getClient() {
|
|
180
|
+
if (!client) client = getTavilyClient(config);
|
|
181
|
+
return client;
|
|
182
|
+
}
|
|
183
|
+
return (0, _mastra_core_tools.createTool)({
|
|
184
|
+
id: "tavily-crawl",
|
|
185
|
+
description: "Crawl a website starting from a URL using Tavily. Extracts content from discovered pages with configurable depth, breadth, and domain constraints. Returns structured content from each crawled page.",
|
|
186
|
+
inputSchema: inputSchema$1,
|
|
187
|
+
outputSchema: outputSchema$1,
|
|
188
|
+
execute: async (input) => {
|
|
189
|
+
const response = await getClient().crawl(input.url, {
|
|
190
|
+
maxDepth: input.maxDepth,
|
|
191
|
+
maxBreadth: input.maxBreadth,
|
|
192
|
+
limit: input.limit,
|
|
193
|
+
instructions: input.instructions,
|
|
194
|
+
selectPaths: input.selectPaths,
|
|
195
|
+
selectDomains: input.selectDomains,
|
|
196
|
+
excludePaths: input.excludePaths,
|
|
197
|
+
excludeDomains: input.excludeDomains,
|
|
198
|
+
allowExternal: input.allowExternal,
|
|
199
|
+
extractDepth: input.extractDepth,
|
|
200
|
+
includeImages: input.includeImages,
|
|
201
|
+
format: input.format
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
baseUrl: response.baseUrl,
|
|
205
|
+
results: (response.results || []).map((r) => ({
|
|
206
|
+
url: r.url,
|
|
207
|
+
rawContent: r.rawContent,
|
|
208
|
+
images: r.images || void 0
|
|
209
|
+
})),
|
|
210
|
+
responseTime: response.responseTime
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
217
214
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/map.ts
|
|
217
|
+
const inputSchema = zod.z.object({
|
|
218
|
+
url: zod.z.string().describe("The root URL to begin mapping"),
|
|
219
|
+
maxDepth: zod.z.number().optional().describe("Max depth of the mapping from the base URL"),
|
|
220
|
+
maxBreadth: zod.z.number().optional().describe("Max number of links to follow per page"),
|
|
221
|
+
limit: zod.z.number().optional().describe("Total number of links the mapper will process before stopping"),
|
|
222
|
+
instructions: zod.z.string().optional().describe("Natural language instructions for the mapper"),
|
|
223
|
+
selectPaths: zod.z.array(zod.z.string()).optional().describe("Regex patterns to select specific URL paths"),
|
|
224
|
+
selectDomains: zod.z.array(zod.z.string()).optional().describe("Regex patterns to restrict to specific domains"),
|
|
225
|
+
excludePaths: zod.z.array(zod.z.string()).optional().describe("Regex patterns to exclude specific URL paths"),
|
|
226
|
+
excludeDomains: zod.z.array(zod.z.string()).optional().describe("Regex patterns to exclude specific domains"),
|
|
227
|
+
allowExternal: zod.z.boolean().optional().describe("Whether to include external domain links")
|
|
229
228
|
});
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
const outputSchema = zod.z.object({
|
|
230
|
+
baseUrl: zod.z.string(),
|
|
231
|
+
results: zod.z.array(zod.z.string()).describe("Discovered URLs"),
|
|
232
|
+
responseTime: zod.z.number()
|
|
234
233
|
});
|
|
235
234
|
function createTavilyMapTool(config) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
});
|
|
235
|
+
let client = null;
|
|
236
|
+
function getClient() {
|
|
237
|
+
if (!client) client = getTavilyClient(config);
|
|
238
|
+
return client;
|
|
239
|
+
}
|
|
240
|
+
return (0, _mastra_core_tools.createTool)({
|
|
241
|
+
id: "tavily-map",
|
|
242
|
+
description: "Map a website's structure starting from a URL using Tavily. Discovers and returns a list of URLs found on the site without extracting page content. Useful for understanding site structure before targeted extraction.",
|
|
243
|
+
inputSchema,
|
|
244
|
+
outputSchema,
|
|
245
|
+
execute: async (input) => {
|
|
246
|
+
const response = await getClient().map(input.url, {
|
|
247
|
+
maxDepth: input.maxDepth,
|
|
248
|
+
maxBreadth: input.maxBreadth,
|
|
249
|
+
limit: input.limit,
|
|
250
|
+
instructions: input.instructions,
|
|
251
|
+
selectPaths: input.selectPaths,
|
|
252
|
+
selectDomains: input.selectDomains,
|
|
253
|
+
excludePaths: input.excludePaths,
|
|
254
|
+
excludeDomains: input.excludeDomains,
|
|
255
|
+
allowExternal: input.allowExternal
|
|
256
|
+
});
|
|
257
|
+
return {
|
|
258
|
+
baseUrl: response.baseUrl,
|
|
259
|
+
results: response.results || [],
|
|
260
|
+
responseTime: response.responseTime
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
});
|
|
268
264
|
}
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/tools.ts
|
|
271
267
|
function createTavilyTools(config) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
268
|
+
return {
|
|
269
|
+
tavilySearch: createTavilySearchTool(config),
|
|
270
|
+
tavilyExtract: createTavilyExtractTool(config),
|
|
271
|
+
tavilyCrawl: createTavilyCrawlTool(config),
|
|
272
|
+
tavilyMap: createTavilyMapTool(config)
|
|
273
|
+
};
|
|
278
274
|
}
|
|
279
|
-
|
|
275
|
+
//#endregion
|
|
280
276
|
exports.createTavilyCrawlTool = createTavilyCrawlTool;
|
|
281
277
|
exports.createTavilyExtractTool = createTavilyExtractTool;
|
|
282
278
|
exports.createTavilyMapTool = createTavilyMapTool;
|
|
283
279
|
exports.createTavilySearchTool = createTavilySearchTool;
|
|
284
280
|
exports.createTavilyTools = createTavilyTools;
|
|
285
281
|
exports.getTavilyClient = getTavilyClient;
|
|
286
|
-
|
|
282
|
+
|
|
287
283
|
//# sourceMappingURL=index.cjs.map
|