import { Static, TObject } from "./_chunks/libs/typebox.mjs"; import { ToolDefinition } from "./_chunks/index.mjs"; import { Tool } from "ai"; /** An image block of the result, base64 with its MIME type, as MCP sends it. */ export interface AiToolImage { data: string; mimeType: string; } /** * What an AI SDK tool returns: the executor's details with the text MCP * clients read. Your code gets the whole object, the model reads `text` and `images`. */ export type AiToolOutput
= (Details extends object ? Details : { details: Details; }) & { text: string; /** The result's image blocks, present only when it has some. */ images?: AiToolImage[]; }; /** * Converts one tool, keeping its input and details types. * * A result with `isError` throws its text, which the AI SDK reports to the * model as a tool error, the same as an executor that throws. The model reads * `text` and the images, as on every other host, not the details spelled out a second time. * * @param definition - Tool to convert. * @returns {Tool} AI SDK tool. */ export declare function toAiTool(definition: ToolDefinition): Tool, AiToolOutput
>; /** What {@link toAiTools} returns: each tool under its own name, typed like {@link toAiTool}. */ export type AiTools = { [Definition in Tools[number] as Definition["name"]]: Definition extends ToolDefinition ? Tool, AiToolOutput
> : never; }; /** * Builds an AI SDK tool set keyed by tool name, typed per tool. * `Object.fromEntries` only knows a record, so the result is cast to the `AiTools` it built. * * @param tools - Tools to convert. * @returns {AiTools} AI SDK tools. * @throws {ToolDefinitionError} When two tools share a name. */ export declare function toAiTools(tools: Tools): AiTools;