Function Schemas

Adding validation constraints to parameters

Validation Rules

Validation rules ensure agents provide correct data. They catch errors before execution and guide agents toward valid inputs.

๐ŸงชInteractive Validation Tester

Select a rule and test different inputs

๐Ÿ“ minLength

Minimum string length

{ "type": "string", "minLength": 3 }
๐Ÿงช Test Input:
โœ…
Valid
Input passes validation
โœ“ Pass Example:
"Hello"
โœ— Fail Example:
"Hi"

๐Ÿ“š Common Validation Rules

String Rules:
โ€ข minLength / maxLength
โ€ข pattern (regex)
โ€ข format (email, url, date)
โ€ข enum (fixed choices)
Number Rules:
โ€ข minimum / maximum
โ€ข exclusiveMinimum / exclusiveMaximum
โ€ข multipleOf
Array Rules:
โ€ข minItems / maxItems
โ€ข uniqueItems
โ€ข items (type of elements)
Object Rules:
โ€ข required (mandatory fields)
โ€ข properties (field definitions)
โ€ข additionalProperties

โœ… Validation Best Practices

โœ“
Be specific: Add constraints that match your business logic
โœ“
Provide defaults: Use "default" property for optional parameters
โœ“
Use enums: Limit choices when values are fixed
โœ“
Format hints: Use "format" for dates, emails, URLs
โœ“
Test thoroughly: Verify edge cases and boundary values