boolean values.
Import
Tool Name Validators
matchToolCalls()
Exact match - all tools in exact order.Parameters
| Parameter | Type | Description |
|---|---|---|
expected | string[] | Expected tool names in order |
actual | string[] | Actual tool names (from result.toolsCalled()) |
Returns
boolean - true if exact match.
Example
matchToolCallsSubset()
Checks if all expected tools were called (any order, extras allowed).Parameters
| Parameter | Type | Description |
|---|---|---|
expected | string[] | Tools that must be present |
actual | string[] | Actual tool names |
Returns
boolean - true if all expected tools are present.
Example
matchAnyToolCall()
Checks if at least one expected tool was called.Parameters
| Parameter | Type | Description |
|---|---|---|
expected | string[] | Any of these tools should be called |
actual | string[] | Actual tool names |
Returns
boolean - true if at least one match.
Example
matchToolCallCount()
Checks if a tool was called exactly N times.Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Tool to count |
actual | string[] | Actual tool names |
count | number | Expected count |
Returns
boolean - true if count matches.
Example
matchNoToolCalls()
Checks that no tools were called.Parameters
| Parameter | Type | Description |
|---|---|---|
actual | string[] | Actual tool names |
Returns
boolean - true if empty.
Example
Argument Validators
matchToolCallWithArgs()
Checks if a tool was called with exactly the specified arguments.Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Tool to check |
expectedArgs | Record<string, unknown> | Expected arguments (exact match) |
toolCalls | ToolCall[] | From result.getToolCalls() |
Returns
boolean - true if exact argument match.
Example
matchToolCallWithPartialArgs()
Checks if a tool was called with arguments containing the expected subset.Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Tool to check |
expectedArgs | Record<string, unknown> | Arguments to match (subset) |
toolCalls | ToolCall[] | From result.getToolCalls() |
Returns
boolean - true if all expected args present with matching values.
Example
matchToolArgument()
Checks if a specific argument has the expected value.Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Tool to check |
argName | string | Argument name |
expectedValue | unknown | Expected value |
toolCalls | ToolCall[] | From result.getToolCalls() |
Returns
boolean - true if argument matches.
Example
matchToolArgumentWith()
Checks if an argument passes a custom predicate.Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Tool to check |
argName | string | Argument name |
predicate | (value: unknown) => boolean | Custom validation function |
toolCalls | ToolCall[] | From result.getToolCalls() |
Returns
boolean - true if predicate returns true.
Example
Usage with Test Frameworks
Jest / Vitest
With EvalTest
Quick Reference
| Validator | Use Case |
|---|---|
matchToolCalls | Exact sequence of tools |
matchToolCallsSubset | Required tools (any order) |
matchAnyToolCall | At least one of these tools |
matchToolCallCount | Tool called N times |
matchNoToolCalls | No tools called |
matchToolCallWithArgs | Exact argument match |
matchToolCallWithPartialArgs | Subset of arguments |
matchToolArgument | Single argument value |
matchToolArgumentWith | Custom validation |
Related
- Testing with LLMs - Conceptual guide
- PromptResult Reference - Get tool calls
- EvalTest Reference - Use in evaluations

