Skip to main content
The SDK provides 9 boolean validator functions for asserting tool call behavior in tests, plus evaluateToolCalls — a richer, configurable matcher that returns structured results.

Import

The matchers module is also available as a standalone browser-safe entry point:

Tool Name Validators

matchToolCalls()

Exact match - all tools in exact order.

Parameters

Returns

boolean - true if exact match.

Example


matchToolCallsSubset()

Checks if all expected tools were called (any order, extras allowed).

Parameters

Returns

boolean - true if all expected tools are present.

Example


matchAnyToolCall()

Checks if at least one expected tool was called.

Parameters

Returns

boolean - true if at least one match.

Example


matchToolCallCount()

Checks if a tool was called exactly N times.

Parameters

Returns

boolean - true if count matches.

Example


matchNoToolCalls()

Checks that no tools were called.

Parameters

Returns

boolean - true if empty.

Example


Argument Validators

matchToolCallWithArgs()

Checks if a tool was called with exactly the specified arguments.

Parameters

Returns

boolean - true if exact argument match.

Example


matchToolCallWithPartialArgs()

Checks if a tool was called with arguments containing the expected subset.

Parameters

Returns

boolean - true if all expected args present with matching values.

Example


matchToolArgument()

Checks if a specific argument has the expected value.

Parameters

Returns

boolean - true if argument matches.

Example


matchToolArgumentWith()

Checks if an argument passes a custom predicate.

Parameters

Returns

boolean - true if predicate returns true.

Example


Usage with Test Frameworks

Jest / Vitest

With EvalTest


evaluateToolCalls()

A configurable matcher that returns a structured result instead of a plain boolean. Use this when you need to know why a match failed (missing tools, argument mismatches, wrong order, extra calls) or when you want to control matching behavior per test case.

Parameters

EvalMatchOptions

EvalToolCallMatchResult

Example

Argument type placeholders

When argumentMatching is "partial" (the default), string values in expected arguments are interpreted as type checks:

Layered match options

resolveMatchOptions merges suite → case → run-override layers on top of defaults. Import it from @mcpjam/sdk/matchers when building custom eval pipelines:

Quick Reference