Skip to main content
The EvalSuite class groups multiple EvalTest instances and provides aggregate metrics across all tests.

Import

Constructor

Parameters

EvalSuiteConfig
Configuration for the evaluation suite.

EvalSuiteConfig

matchOptions is a default, not an override: a test that sets its own keeps it. This mirrors how the hosted product layers suite → case, so a suite behaves the same whether it runs from your test file or from the platform.
When an API key is available — via mcpjam.apiKey or the MCPJAM_API_KEY environment variable — all test results are consolidated into a single run and saved to MCPJam after the suite completes. Individual EvalTest auto-saves are suppressed to avoid duplicate uploads. Set mcpjam.enabled: false to disable.

Example

With results saved to MCPJam:

Methods

runWithClient()

Run code-authored tests with the latest saved client in your project:
The client is fetched once when the run starts. Its model, system prompt, temperature, and supported tool visibility settings stay fixed for every test and iteration. Starting another run fetches the latest saved settings again. Client lookup and tool setup share the run’s timeout and cancellation signal. Results are saved to the selected project with the client name and version used. The results table shows the name; hover or focus shows My client · v3. Later edits, renames, and deletion do not change previously saved results. Set mcpjam.enabled: false to run without uploading results. runWithClient uses MCPJam inference for Anthropic Claude and OpenAI GPT-5 models, billed to that project. It requires a backend that returns saved client versions. The optional baseUrl is the MCPJam app origin for a custom deployment. Your code owns server connections, credentials, and MCP connection settings; the client’s saved server IDs and connection overrides are not applied to those connections. The first release does not launch cloud computers, browsers, saved skills, built-in tools, progressive tool discovery, or interactive approvals. Clients requiring these features fail before tests execute. Existing run(executor) calls keep their current behavior.

add()

Adds a test to the suite.

Parameters

Example


run()

Runs all tests in the suite and returns aggregate results.

Parameters

EvalTestRunOptions

EvalSuiteResult

Example

Tests within the suite run sequentially, but each test’s iterations can run concurrently based on the concurrency setting.

accuracy()

Returns the aggregate accuracy across all tests.

Returns

number - Average accuracy of all tests (0.0 - 1.0).

Example


get()

Retrieves a specific test by name.

Parameters

Returns

EvalTest | undefined - The test, or undefined if not found.

Example


getAll()

Returns all tests in the suite.

Returns

EvalTest[] - Array of all tests.

Example


getName()

Returns the suite’s name.

size()

Returns the number of tests in the suite.

getResults()

Returns the full suite results from the last run.

recall()

Aggregate recall across every test in the suite that declared expectedToolCalls.

precision()

Aggregate precision across every test in the suite that declared expectedToolCalls.
Changed in 3.0. These returned accuracy() — the suite’s pass rate — under all three names. They now aggregate real tool-call counts and throw when no test in the suite declared expectedToolCalls. Tests without expectations are skipped in the aggregate rather than counted as perfect. See EvalTest.precision() for how the counts are derived.

truePositiveRate()

Aggregate true positive rate (same as recall).

unexpectedToolCallRate()

The fraction of expectation-bearing iterations across the suite that made at least one tool call nobody asked for.

falsePositiveRate()

Deprecated in 3.0 — use unexpectedToolCallRate(). It returned failures / iterations, which is the failure rate. Suites with no expectedToolCalls still get that legacy value; suites with expectations now delegate to unexpectedToolCallRate().

averageTokenUse()

Returns average tokens per iteration across all tests.

Properties

name

The suite’s name (via getName()).

Complete Example


Patterns

CI gate on suite accuracy

accuracy() is the suite-wide rate: one number over every iteration the run executed. Gating on it asks the same question a hosted suite’s suite accuracy threshold asks.

CI gate on per-case pass rates

A per-test threshold asks the OTHER question — the one a hosted suite’s per-case pass rate asks — and the two do not agree. Nine of ten tests always passing and one always failing gives a suite accuracy of 0.9, which clears the gate above, while the tenth test’s own rate is 0. Gate on whichever question you actually mean; a fraction is not a percentage of the other one.

Per-Test Thresholds

Comparing Across Providers


See Reliable evals in CI for canonical evaluators, reporting receipts, explicit limits, metadata compatibility, and migration guidance.