Skip to content

normalizeToolValues

normalizeToolValues(spec, raw): Record<string, ToolValue>

Turns whatever values arrived from the host into exactly what ToolValues promises: every declared field present and of its type, nothing else. A missing or mistyped value falls back to the field’s default, then to empty ("", 0 or min, false, the first option, []). Numbers are clamped to min/max.

Parameter Type
spec Pick<ToolSpec, "fields">
raw unknown

Record<string, ToolValue>