import type { Tool } from './tool'; import { wrapToolExecution } from './validation'; export function normalizeToolDefinition( toolDef: Tool, executeFn: (args: Input) => Promise | Output ): Tool { const validatedExecute = wrapToolExecution(toolDef, executeFn); return { ...toolDef, execute: validatedExecute as (args: Input) => Promise | Output, }; }