/** * Tool-call argument validation pipeline. * * Tools may declare ArkType schemas or plain JSON Schema. This module builds a * cached validation context, normalizes common LLM quirks against the wire * schema, validates, performs conservative schema-directed coercions, and * returns parsed arguments while preserving unknown root fields. * * The goal is to be conservative: every coercion is a structural rewrite that * keeps the schema in charge of acceptance — we never invent values, only * massage shapes the LLM almost got right. */ import type { Tool, ToolCall } from "../types.js"; /** * Finds a tool by name and validates the tool call arguments against its schema. * @param tools Array of tool definitions * @param toolCall The tool call from the LLM * @returns The validated arguments * @throws Error if tool is not found or validation fails */ export declare function validateToolCall(tools: Tool[], toolCall: ToolCall): ToolCall["arguments"]; /** * Validates tool call arguments against an ArkType or plain JSON Schema schema. * Applies conservative LLM-quirk normalization before declaring failure. * * @throws Error with a formatted message when validation cannot be reconciled. */ export declare function validateToolArguments(tool: Tool, toolCall: ToolCall): ToolCall["arguments"];