import { ToolSet } from "ai"; import { Toolkit } from "@assistant-ui/core/react"; import { ToolJSONSchema } from "assistant-stream"; //#region src/generativeTools.d.ts /** * @deprecated Options for the deprecated {@link generativeTools}. Use * {@link AISDKToolkit} with {@link AISDKToolkitOptions} / * {@link AISDKToolkitToolsOptions} instead. */ interface GenerativeToolsOptions { /** * The server build of a generative toolkit (schema + server `execute`). Typed * as the canonical {@link Toolkit} so callers don't need to cast; the server * build carries `execute`, recovered internally as {@link ToolkitDefinition}. */ toolkit: Toolkit; /** * Tools uploaded by the frontend (the request body's `tools`). Merged in * alongside the `toolkit`; a server `execute` from `toolkit` takes precedence * over an uploaded entry of the same name. */ frontendTools?: Record; } type AISDKToolkitOptions = { toolkit: Toolkit; }; type AISDKToolkitToolsOptions = { /** * Tools uploaded by the frontend request body. */ frontend?: Record; }; /** * Builds an AI SDK `ToolSet` for server-side use with `streamText` / * `generateText` from a generative `toolkit` and the frontend-uploaded tools. * * Each toolkit tool's `execute` runs on the server. Pair this with the * `"use generative"` compiler: import the toolkit in a server route (where it * resolves to the server build — schema + `execute`, with `render` stripped) and * pass it here. Tools without an `execute` are still exposed to the model but * left for the client to fulfill. `frontendTools` lets the client contribute * tools that aren't in the static toolkit. * * @deprecated Use {@link AISDKToolkit} instead: * `new AISDKToolkit({ toolkit }).tools({ frontend })`. It is a strict superset * (it also opens MCP server connections), so it replaces `generativeTools` * everywhere. The `frontendTools` option is named `frontend` on `.tools()`, and * `.tools()` is async. `generativeTools` will be removed in a future version. * * @example * ```ts * // Define once at module scope so any MCP connections pool across requests. * const aiToolkit = new AISDKToolkit({ toolkit: docsToolkit }); * * // In your route handler: * const { tools } = await req.json(); * streamText({ * model, * messages, * tools: await aiToolkit.tools({ frontend: tools }), * }); * ``` */ declare const generativeTools: (options: GenerativeToolsOptions) => ToolSet; declare class AISDKToolkit { #private; constructor(options: AISDKToolkitOptions); tools(options?: AISDKToolkitToolsOptions): Promise; close(): Promise; } //#endregion export { AISDKToolkit, AISDKToolkitOptions, AISDKToolkitToolsOptions, GenerativeToolsOptions, generativeTools }; //# sourceMappingURL=generativeTools.d.ts.map