SchemaValidator
JSON Schema validator for tool arguments. Validates arguments against the tool's input schema before execution.
SchemaValidator::validate()
public function validate(array $args, array $schema): Milpa\ToolRuntime\Validation\ValidationResultValidate arguments against a JSON schema.
Parameters
| Name | Type | Description |
|---|---|---|
| $args | array<string, mixed> | The arguments to validate |
| $schema | array<string, mixed> | The JSON schema |
SchemaValidator::applyClamps()
public function applyClamps(array $args, array $clamps): arrayValidate and apply clamps to arguments.
Parameters
| Name | Type | Description |
|---|---|---|
| $args | array<string, mixed> | Arguments to clamp |
| $clamps | array<string, array<string, mixed>> | Clamp definitions ['field' => ['min' => x, 'max' => y]] |
Returns
Clamped arguments