Skip to main content

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

ParameterTypeDescription
toolCallsarrayArray of tool call objects
Each tool call object should have:

Configuration

All config parameters are optional:
ParameterTypeDescription
expectedstring/arrayRequired tool names
forbiddenstring/arrayTools that should NOT be called
minToolsnumberMinimum number of tools that should be called
maxToolsnumberMaximum number of tools allowed
orderarrayExpected order of tool calls
validateArgsobjectExpected arguments for each tool

Output Fields

FieldTypeDescription
passedbooleanWhether all validations passed
failuresarrayList of validation failures
scorenumberValidation score (0.0 - 1.0)
actualToolsarrayTool names that were actually called
expectedToolsarrayTool names that were expected

Examples

Validate Expected Tools

Success:
Failure:

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:
Compatible with:
  • OpenAI function calling format
  • Anthropic tool use format
  • Vercel AI SDK tool calls
StreamParser automatically extracts tool calls into this format from streaming responses.

Validation Score

The score 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)
Factors that reduce score:
  • Missing expected tools
  • Using forbidden tools
  • Wrong tool count
  • Incorrect order
  • Argument mismatches

Error Messages

Common failure messages:
MessageCause
Missing expected tools: tool1, tool2Expected tools not called
Used forbidden tools: tool1Forbidden tool was called
Too few tools: 1 < 2Below minTools
Too many tools: 5 > 3Above maxTools
Tool order incorrectTools called in wrong order
Tool 'search' arg 'limit' mismatchTool argument doesn’t match expected value

Full Example

Tips

StreamParser extracts tool calls from streaming responses:
Use order to validate sequential tool usage:
ValidateTools checks structure, LLMJudge checks reasoning:
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
Don’t use when:
  • No tool/function calling involved
  • Testing pure text generation
  • Validating non-AI responses

Next Steps

StreamParser

Parse streaming responses with tool calls

LLMJudge

Validate AI response quality