import { g as readPositiveIntegerParam } from "./common-Df2rEPbV.js";
import "./param-readers-B92jFCmA.js";
import { n as buildTavilyWebSearchProviderBase } from "./web-search-shared-C-InZaFj.js";
//#region extensions/tavily/src/tavily-search-provider.ts
let tavilyClientModulePromise;
function loadTavilyClientModule() {
	tavilyClientModulePromise ??= import("./tavily-client-COl0ABZZ.js");
	return tavilyClientModulePromise;
}
const GenericTavilySearchSchema = {
	type: "object",
	properties: {
		query: {
			type: "string",
			description: "Search query string."
		},
		count: {
			type: "integer",
			description: "Number of results to return (1-20).",
			minimum: 1,
			maximum: 20
		}
	},
	additionalProperties: false
};
function createTavilyWebSearchProvider() {
	return {
		...buildTavilyWebSearchProviderBase(),
		createTool: (ctx) => ({
			description: "Search the web using Tavily. Returns structured results with snippets. Use tavily_search for Tavily-specific options like search depth, topic filtering, or AI answers.",
			parameters: GenericTavilySearchSchema,
			execute: async (args) => {
				const { runTavilySearch } = await loadTavilyClientModule();
				return await runTavilySearch({
					cfg: ctx.config,
					query: typeof args.query === "string" ? args.query : "",
					maxResults: readPositiveIntegerParam(args, "count", {
						message: "count must be an integer from 1 to 20",
						max: 20
					})
				});
			}
		})
	};
}
//#endregion
export { createTavilyWebSearchProvider as t };
