Overview
The ValidateTools block validates that AI models call the correct tools/functions with the right arguments. Essential for testing AI agents and function-calling models.Input Parameters
Required
Parameter | Type | Description |
---|---|---|
toolCalls | array | Array of tool call objects |
Configuration
All config parameters are optional:Parameter | Type | Description |
---|---|---|
expected | string/array | Required tool names |
forbidden | string/array | Tools that should NOT be called |
minTools | number | Minimum number of tools that should be called |
maxTools | number | Maximum number of tools allowed |
order | array | Expected order of tool calls |
validateArgs | object | Expected arguments for each tool |
Output Fields
Field | Type | Description |
---|---|---|
passed | boolean | Whether all validations passed |
failures | array | List of validation failures |
score | number | Validation score (0.0 - 1.0) |
actualTools | array | Tool names that were actually called |
expectedTools | array | Tool names that were expected |
Examples
Validate Expected Tools
Forbid Dangerous Tools
Validate Tool Count
Validate Tool Order
Validate Tool Arguments
Combined Validations
Common Patterns
Test AI Agent Tool Usage
Ensure Safe Tool Usage
Validate Multi-Step Agent
Tool Call Format
The block expects tool calls in this format:- OpenAI function calling format
- Anthropic tool use format
- Vercel AI SDK tool calls
Validation Score
Thescore
field represents validation quality:
- 1.0 - All validations passed
- 0.5 - 0.9 - Some issues (missing tools, wrong order)
- < 0.5 - Significant issues (forbidden tools used, major mismatches)
- Missing expected tools
- Using forbidden tools
- Wrong tool count
- Incorrect order
- Argument mismatches
Error Messages
Common failure messages:Message | Cause |
---|---|
Missing expected tools: tool1, tool2 | Expected tools not called |
Used forbidden tools: tool1 | Forbidden tool was called |
Too few tools: 1 < 2 | Below minTools |
Too many tools: 5 > 3 | Above maxTools |
Tool order incorrect | Tools called in wrong order |
Tool 'search' arg 'limit' mismatch | Tool argument doesn’t match expected value |
Full Example
Tips
Use StreamParser First
Use StreamParser First
StreamParser extracts tool calls from streaming responses:
Order Matters for Multi-Step Agents
Order Matters for Multi-Step Agents
Use
order
to validate sequential tool usage:Combine with LLMJudge
Combine with LLMJudge
ValidateTools checks structure, LLMJudge checks reasoning:
Use Forbidden for Safety
Use Forbidden for Safety
Prevent dangerous operations:
When to Use
Use ValidateTools when:- Testing AI function calling
- Validating agent tool usage
- Ensuring safe tool execution
- Testing multi-step workflows
- Verifying tool arguments
- No tool/function calling involved
- Testing pure text generation
- Validating non-AI responses