agents
Version:
A home for your AI agents
79 lines (77 loc) • 2.13 kB
TypeScript
import {
S as WebFetchVia,
_ as WEB_FETCH_TOOL_NAME,
b as WebFetchToolInput,
c as WebFetchRequest,
l as WebFetchSource,
n as WebFetchToolOptions,
o as WebFetchError,
s as WebFetchErrorCode,
v as WebFetchFormat,
x as WebFetchToolOutput,
y as WebFetchPage
} from "../../../tool-DoVberpN.js";
//#region src/web/fetch/tools/tanstack-ai.d.ts
type TanStackWebFetchToolOptions<
TName extends string = typeof WEB_FETCH_TOOL_NAME
> = WebFetchToolOptions & {
/** The tool's name. TanStack AI tools carry it in the definition. */ name?: TName;
};
/**
* Create a TanStack AI tool that reads a URL as Markdown, JSON, or text.
* TanStack AI has one return channel, so the model and the host both get
* the rendered window. A failed fetch throws a `WebFetchError`, which
* TanStack AI reports as an error result: its `message` is written for the
* model, and its `cause` is the source's error with the detail. The tool is
* named `web_fetch` unless you pass `name`.
*
* @example
* ```ts
* import { webFetchTool } from "agents/webfetch/tanstack-ai";
* import { chat } from "@tanstack/ai";
*
* const stream = chat({
* adapter,
* tools: [webFetchTool({ binding: env.AI })],
* messages
* });
* ```
*/
declare function webFetchTool<
TName extends string = typeof WEB_FETCH_TOOL_NAME
>(
options: TanStackWebFetchToolOptions<TName>
): import("@tanstack/ai").ServerTool<
import("zod").ZodObject<
{
url: import("zod").ZodString;
offset: import("zod").ZodOptional<import("zod").ZodNumber>;
format: import("zod").ZodOptional<
import("zod").ZodEnum<{
auto: "auto";
raw: "raw";
}>
>;
},
import("zod/v4/core").$strip
>,
import("@tanstack/ai").SchemaInput,
TName,
unknown
>;
//#endregion
export {
TanStackWebFetchToolOptions,
WebFetchError,
type WebFetchErrorCode,
type WebFetchFormat,
type WebFetchPage,
type WebFetchRequest,
type WebFetchSource,
type WebFetchToolInput,
type WebFetchToolOptions,
type WebFetchToolOutput,
type WebFetchVia,
webFetchTool
};
//# sourceMappingURL=tanstack-ai.d.ts.map