import type { JSONSchema, ToolSet } from './types'; /** Build the instruction appended to the system prompt to enable tool calling. */ export declare function buildToolInstruction(tools: ToolSet): string; /** * What {@link parseToolCall} found in a model response. * * - `tool`: a well-formed call to a known tool (args still need schema validation). * - `unknown-tool`: looked like a tool call but the name isn't in the tool set. * - `text`: no tool call — treat the response as the final answer. */ export type ParsedToolCall = { kind: 'tool'; toolName: string; args: unknown; } | { kind: 'unknown-tool'; toolName: string; } | { kind: 'text'; }; /** * Detect a tool call in model output. * * A response is a tool call when it contains a JSON object (possibly wrapped in * prose or a ```json fence) with a string `tool` field. We tolerate `arguments` * or `args` for the payload. If `tool` names something not in `toolNames` it's * reported as `unknown-tool` so the loop can re-prompt instead of leaking the * raw JSON as an answer. Anything else is plain `text`. */ export declare function parseToolCall(text: string, toolNames: string[]): ParsedToolCall; /** Follow-up prompt when the model named a tool that doesn't exist. */ export declare function buildUnknownToolRepair(toolName: string, toolNames: string[]): string; /** Follow-up prompt when a tool's proposed arguments failed schema validation. */ export declare function buildToolArgsRepair(toolName: string, errors: string[]): string; /** * Render a tool result as the user-turn text fed back to the model. * Non-string results are JSON-encoded; strings pass through as-is. */ export declare function formatToolResult(toolName: string, result: unknown): string; export type { JSONSchema }; //# sourceMappingURL=tools.d.ts.map