Skip to content

ToolInputSchemaValidator

Namespace: Vercel.AI.Util

public static class ToolInputSchemaValidator

Validates a tool call input against the JSON Schema of a tool. Covers the keywords tool schemas use: type, enum, const, properties, required, additionalProperties, items, minItems, maxItems, minLength, maxLength, minimum, maximum, anyOf, oneOf and allOf. Other keywords are ignored.

Inheritance: object

View source

public static IReadOnlyList<string> Validate(JsonElement schema, JsonElement value)

Returns the validation errors of <code class=“paramref”>value</code>, or an empty list when it is valid.

Parameters

Name Type Description
schema JsonElement
value JsonElement

Returns: IReadOnlyList<string>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product