Writes evals for MCP servers using @gleanwork/mcp-server-tester (MST). Creates datasets with cases (input, expectations, assertions) and runs them via Playwright tests or `mst run` to grade model tool selection and compare server variants.
Ships in mcp-server-tester. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An eval has a client act on cases and grades what it did. Each case gives the client an input (the user's request). The client runs it with a model and returns a transcript: the tools it called and its final answer. Assertions and judges grade each trial, and MST decides whether the case passed.
A check that calls a tool with fixed arguments has no client, so it is a test, not an eval. Write those with the write-mcp-test skill. Datasets hold only cases for a client.
await mcp.listTools() in a test, or the server source). Every tool name in an assertion must exist.Playwright test with runEvalDataset | mst run with an eval config | |
|---|---|---|
| Client | api only, on the test's MCP connection | api, claude-code, codex-cli, cowork, chatgpt, codex-app, or a plugin's client |
| Compares | one setup per call | several variants in one run, each compared with the baseline |
| Results | the MCP Playwright reporter | a run directory with its report, and a table per variant |
Start with a Playwright test on api while you write cases. Use an eval config to run them on another client or to compare variants.
A dataset is a JSON file with a name and a list of cases:
{
"name": "search-evals",
"cases": [
{
"id": "find-planning-doc",
"input": "Find the Q3 planning document",
"assertions": {
"toolsTriggered": {
"calls": [{ "name": "search", "required": true }]
}
}
}
]
}
Case fields:
| Field | Required | Meaning |
|---|---|---|
id | yes | Unique within the dataset |
input | yes | The user's request, sent to the client as its prompt |
description | no | What the case is for |
expected | no | Ground truth for graders: answer, criteria (rubric criteria by name), any other key |
assertions | no | Code graders: toolsTriggered, toolCallCount, containsText, matchesPattern |
judges | no | LLM graders: the built-in rubric judge or a plugin's judges, beside assertions |
tags | no | Labels for filtering (filterTags) and grouping (regression, held-out) |
trials | no | Trials of this case (default 1) |
passThreshold | no | Share of trials that must pass, 0 to 1 (default 1) |
judgeReps | no | Times each judge scores a trial; the mean is compared with its threshold |
client, model, clientOptions | no | This case's own client, model or client options, over what it inherits |
metadata | no | Free-form data kept with the case |
A key MST doesn't define fails validation, so a misspelt assertion never silently skips. Keys from 1.x fail with a message that names the replacement:
| 1.x | 2.0 |
|---|---|
scenario | input |
expect | assertions |
iterations | trials |
accuracyThreshold | passThreshold |
canonicalAnswer | expected.answer |
mode | remove it: every case runs on a client |
mcpHostConfig | client, model, clientOptions |
toolName + args, request | a Playwright test (write-mcp-test) |
response, schema, snapshot, isError, responseSize | matchers in a Playwright test |
One phrasing tells you that phrasing works, not that the tool description works.
search without saying "search".exclusive: true."toolCallCount": { "exact": 0 }.Every assertion in a case's assertions must pass for a trial to pass.
| Assertion | Passes when |
|---|---|
toolsTriggered | The client called the listed tools (optionally in order, only those) |
toolCallCount | The number of tool calls is within min/max, or equals exact |
containsText | The final answer contains every listed substring |
matchesPattern | The final answer matches every listed regular expression |
toolsTriggered"toolsTriggered": {
"calls": [
{ "name": "search", "required": true },
{ "name": "get_document", "required": false }
],
"order": "any",
"exclusive": false
}
required defaults to true. A call with required: false may happen; with exclusive: true it is also allowed.
order: "strict" requires the listed calls in that order (an optional call may be missing). The default is "any".
exclusive: true fails the trial if the client calls any tool not in calls.
arguments matches part of the call's arguments: listed keys must match, extra keys are allowed. A value can be a regular expression:
{
"name": "search",
"arguments": {
"query": { "$pattern": "onboarding.*engineer", "$flags": "i" },
"limit": 10
}
}
With several servers, name the server: "server": "docs", or "name": "docs.search" (the server's label, a dot, the tool).
kind (tool_call, skill, command, subagent, tool_search) and source (mcp or builtin) match other events in the transcript, such as a skill the client loaded.
Tool assertions need a client whose transcript is structured evidence. All built-in clients are. A plugin client that doesn't declare structured evidence can only pass text and judge assertions.
containsText and matchesPatternThey check the client's final answer, not a tool's output:
"containsText": ["Q3", "planning"],
"matchesPattern": ["\\d+ results"]
Escape backslashes in JSON (\\d).
A judge is an LLM that grades the trial. A case lists its judges in judges, beside assertions. The built-in judges:
unknown when the transcript can't settle it. task-completion: did the assistant do what was asked? grounded-in-tools: does a tool result support every claim? tool-use: right tools, fitting arguments, no needless calls, errors recovered? criteria: does the trial meet each of the case's own criteria, { "id", "text", "required"? }? Prefer these: one narrow question is easier for a judge to get right and for a person to check.rubric scores the answer from 0 to 1 against a built-in rubric (correctness, completeness, groundedness, instruction-following, conciseness) or your own text.{
"id": "pto-policy",
"input": "How many days of PTO do new employees get?",
"expected": { "answer": "New employees get 20 days of PTO a year." },
"judges": [
"task-completion",
{
"type": "criteria",
"criteria": [
{
"id": "pto-days",
"text": "The answer says new employees get 20 days."
}
]
},
{ "type": "rubric", "rubric": "correctness", "threshold": 0.75 },
{
"type": "rubric",
"rubric": {
"text": "Score 1 if the answer cites the policy document, 0.5 if it gives the number without a source, 0 otherwise."
}
}
]
}
rubric judge passes when its mean score reaches its threshold (default 0.7). Every listed judge must pass, and unknown is not a pass.expected.answer is what the judge compares the answer with, unless the judge sets reference.judges apply to every case, on top of the case's own.provider (anthropic by default, vertex-anthropic, anthropic-agent-sdk, openai, google), model, temperature, maxTokens. The default anthropic judge needs @anthropic-ai/sdk and ANTHROPIC_API_KEY.<namespace>/judge/<name>: "acme/judge/completeness", or { "type": "acme/judge/completeness", "threshold": 0.8 } with options. Load the plugin where the cases run (Step 5).Judges cost a model call per trial (times reps; tool-use makes four, criteria one per criterion). Prefer toolsTriggered when the question is which tool was called.
A judge's pass rate is only as good as the judge. Before a decision rests on one, measure it against your own labels: calibrate-mcp-judge.
Models are non-deterministic. One trial can't tell a good tool description from a lucky one.
{
"id": "search-reliability",
"input": "Find documents about MCP testing",
"trials": 10,
"passThreshold": 0.8,
"assertions": {
"toolsTriggered": { "calls": [{ "name": "search" }] }
}
}
This case passes when at least 8 of its 10 trials pass. Its result has passRate (the share of trials that passed, with passRateCI) and trialResults. Trials that failed on infrastructure (a network error, a client that didn't start) aren't counted.
defaultTrials (Playwright) or trials (eval config) rather than on each case.passThreshold: 1 for critical tools. Use 0.8 to 0.9 for most cases, so normal variation doesn't fail the run.The api client gives the model the server's tools and nothing else. In a Playwright test it uses the test's MCP connection (mcpConfig in playwright.config.ts; see write-mcp-test).
npm install --save-dev ai @ai-sdk/anthropic # usually installed already, as optional dependencies
export ANTHROPIC_API_KEY=...
// tests/search-evals.spec.ts
import { test, expect } from '@gleanwork/mcp-server-tester/fixtures/mcp';
import { loadEvalDataset, runEvalDataset } from '@gleanwork/mcp-server-tester';
test('search evals', async ({ mcp }, testInfo) => {
const dataset = await loadEvalDataset('./evals/search-evals.json');
const result = await runEvalDataset(
{
dataset,
client: 'api',
model: 'claude-haiku-4-5',
clientOptions: { maxToolCalls: 8, temperature: 0 },
defaultTrials: 10,
},
{ mcp, testInfo }
);
expect(result.failed).toBe(0);
});
runEvalDataset(options, context) takes two objects: what to run, then the Playwright context. Pass testInfo so the reporter shows the results.
| Option | Meaning |
|---|---|
dataset | From loadEvalDataset(path) or loadEvalDatasetFromObject(object) |
client, model, clientOptions | The client (only api here), its model, and its options |
defaultTrials, defaultPassThreshold | For cases that don't set trials or passThreshold |
defaultJudgeReps | For cases that don't set judgeReps |
filterTags | Run only cases with one of these tags |
concurrency | Cases run at once (mind the provider's rate limits) |
plugins | Plugin objects whose judges the cases name |
saveResultsTo, baselineResultsFrom | Save this run, or compare with a saved earlier run |
The api client infers the API from the model id (claude-* is Anthropic, claude-*@date Vertex, gpt-* OpenAI, gemini-* Google). Its clientOptions: provider (to override that), maxToolCalls (default 5), temperature, maxTokens, timeout (ms), apiKeyEnvVar, systemPrompt, and skills (off, catalog, preload, for servers that serve Agent Skills).
The result has total, passed, failed, and caseResults. Each case result has pass, scores (one per grader), toolCallTranscript (calls marked expected or unexpected, and missed tools), toolPrecision and toolRecall, and for several trials passRate and trialResults.
To see whether a change broke cases that passed before, save one run and compare the next with it:
const result = await runEvalDataset(
{
dataset,
client: 'api',
model: 'claude-haiku-4-5',
defaultTrials: 10,
baselineResultsFrom: '.mcp-test-results/search-baseline.json',
},
{ mcp, testInfo }
);
expect(result.regressions ?? 0).toBe(0);
Write the file first with saveResultsTo: '.mcp-test-results/search-baseline.json' on a known-good run.
mst runAn eval config is a JSON file that names the datasets, the servers, the client and model, and the graders. mst run runs it on any client.
{
"name": "search-evals",
"datasets": ["./search-evals.json"],
"servers": {
"docs": {
"transport": "stdio",
"command": "node",
"args": ["./dist/server.js"]
}
},
"client": "claude-code",
"model": "claude-sonnet-4-6",
"trials": 10,
"passThreshold": 0.8,
"metrics": ["passed", "tool_count", "input_tokens", "duration_s"]
}
servers is a map: the key is the server's label in transcripts and the report.client, an eval config runs on claude-code. Name the client every time.auth.accessTokenEnv on an HTTP server and pass values with --secrets-file or the environment.npx mst run --config evals/eval.json --dry-run # validate config, plugins and datasets
npx mst run --config evals/eval.json --case find-planning-doc --trials 1
npx mst run --config evals/eval.json
mst run prints a row per variant (cases passed, trial pass rate, MCP calls, tokens, cost, time) and the change since the previous run of the same eval config. It writes the run to .mcp-test-results/<name>/runs/<run-id>/ (results.json, summary.json, transcripts, scores and report/) and exits 1 if any case failed. npx mst open opens the newest run's report: the result, the variants compared, what differs, every case and trial, and why trials failed. Set redactStoredResponses: false in the eval config to see answers and tool outputs in it.
Every key, the clients, and what variants inherit: references/eval-configs.md. Reading the results, incomplete cases, resuming and regrading a run: run-mcp-eval.
A variant is one setup the eval tests. Every variant runs the same cases, and each is compared with the baseline, the first variant unless baseline names another.
{
"name": "search-servers",
"datasets": ["./search-evals.json"],
"servers": {
"prod": { "transport": "http", "serverUrl": "https://mcp.example.com/mcp" },
"next": {
"transport": "http",
"serverUrl": "https://staging.example.com/mcp"
}
},
"client": "api",
"model": "claude-sonnet-4-6",
"trials": 10,
"variants": [
{ "name": "prod", "servers": ["prod"] },
{ "name": "next", "servers": ["next"] },
{
"name": "next-with-prompt",
"servers": ["next"],
"clientOptions": {
"systemPrompt": "Search internal documents before answering."
}
}
]
}
A variant can change its servers (by label), client, model, clientOptions, tools (tool metadata), toolMap, inputTemplate, metrics or judges. A variant that lists no servers uses all of them. To try tool descriptions without changing the server, give a variant tools; the optimize-mcp-tool-metadata skill covers that.
Change one thing per variant, so a difference has one cause.
evals/search-evals.json:
{
"name": "search-evals",
"description": "Does the model use search and get_document for document questions?",
"cases": [
{
"id": "find-planning-doc",
"input": "Find the Q3 planning document",
"tags": ["regression"],
"assertions": {
"toolsTriggered": { "calls": [{ "name": "search" }] }
}
},
{
"id": "find-planning-doc-indirect",
"input": "What did we decide about hiring in the Q3 plan?",
"assertions": {
"toolsTriggered": { "calls": [{ "name": "search" }] },
"toolCallCount": { "min": 1, "max": 4 }
}
},
{
"id": "search-arguments",
"input": "Look for onboarding guides for new engineers",
"assertions": {
"toolsTriggered": {
"calls": [
{
"name": "search",
"arguments": {
"query": { "$pattern": "onboarding", "$flags": "i" }
}
}
]
}
}
},
{
"id": "search-then-read",
"input": "Open the latest onboarding guide and list its sections",
"assertions": {
"toolsTriggered": {
"calls": [{ "name": "search" }, { "name": "get_document" }],
"order": "strict"
}
}
},
{
"id": "only-search",
"input": "Which documents mention the API redesign?",
"assertions": {
"toolsTriggered": {
"calls": [{ "name": "search" }],
"exclusive": true
}
}
},
{
"id": "no-tool-needed",
"input": "What is 12 times 12?",
"assertions": {
"toolCallCount": { "exact": 0 },
"containsText": "144"
}
},
{
"id": "pto-answer",
"input": "How many days of PTO do new employees get?",
"expected": { "answer": "New employees get 20 days of PTO a year." },
"assertions": {
"toolsTriggered": { "calls": [{ "name": "search" }] }
},
"judges": [
{ "type": "rubric", "rubric": "correctness", "threshold": 0.75 }
]
}
]
}
tests/search-evals.spec.ts:
import { test, expect } from '@gleanwork/mcp-server-tester/fixtures/mcp';
import { loadEvalDataset, runEvalDataset } from '@gleanwork/mcp-server-tester';
test.describe('search evals', () => {
test('all cases', async ({ mcp }, testInfo) => {
const dataset = await loadEvalDataset('./evals/search-evals.json');
const result = await runEvalDataset(
{
dataset,
client: 'api',
model: 'claude-haiku-4-5',
defaultTrials: 10,
defaultPassThreshold: 0.8,
},
{ mcp, testInfo }
);
expect(result.failed).toBe(0);
});
});
Each trial is a full model conversation with every tool's definition in the prompt, and each judge adds a call. A dataset of 20 cases with 10 trials is 200 conversations per variant. Keep it down:
--trials 1 or defaultTrials: 1, then raise trials for the run that decides something.--case (mst run) or filterTags (runEvalDataset).toolsTriggered and toolCallCount before judges.pricing (see the reference).id and an input written as a user would askscenario, expect, mode, toolName, iterations, accuracyThreshold, mcpHostConfig)toolsTriggered exist on the server; with several servers, calls name the servertrials of 10 or more for any result you act on, with a passThreshold you chose on purpose$pattern strings are valid regular expressions, with backslashes escapedrunEvalDataset(options, { mcp, testInfo }) with client: 'api' and a modelservers is a map, variants list server labels, client is set, and npx mst run --config <path> --dry-run passesWhat SKILL.md sets; muted values are Claude Code's defaults
/mcp-server-tester:write-mcp-evalfrom mcp-server-tester
npx claudepluginhub gleanwork/mcp-server-tester --plugin mcp-server-tester6 skills in this plugin
/calibrate-mcp-judgeDecide how far to trust an LLM judge in an MST eval by measuring it against your own labels. Covers choosing a judge that can be checked, collecting a run to label, labeling trials with mst label, measuring the judge with mst judges check, reading TPR, TNR, kappa and unknown, improving a judge without fitting it to the labels, and when a calibration goes stale. Use when asked whether a judge is accurate or can be trusted, to calibrate or validate a judge, to label trials, to check judge agreement, or when judge scores look wrong./mcp-tester-guideReference for @gleanwork/mcp-server-tester (MST) 2.0, the Playwright-based testing and evaluation framework for MCP servers, with the `mst` CLI. Covers which skill to use for a task, the vocabulary (test, eval, case, client, variant, trial, assertion, judge), entry points, server config and auth, clients, judges, plugin names, CLI commands, what 1.x names became, and common mistakes. Use when working on MCP server tests or evals, or reading or upgrading code that uses MST./optimize-mcp-tool-metadataImprove an MCP server's tool metadata (tool names, descriptions, input schema descriptions) with measured evidence, using `mst optimize` (start, evidence, try, finish), runToolOptimization from @gleanwork/mcp-server-tester/evals, or `mst run` with tool-metadata variants. Use when asked to improve tool descriptions, fix tools a model misses or over-uses, optimize tool discoverability, or compare description rewrites. Produces a recommendation with the exact metadata to apply; never edits the server or the dataset unless asked./run-mcp-evalRun an MCP eval with mst and read what it says. Covers checking a config before it spends money, small runs first, reading the pass rate and its range, comparing variants and the previous run, incomplete cases and infrastructure failures, resuming a run, grading it again, Docker and detached runs, and CI. Use when asked to run an eval, why an eval failed, what a run's results mean, to rerun or resume a run, regrade a run, or run evals in Docker or CI./write-mcp-testWrite Playwright tests for MCP servers with @gleanwork/mcp-server-tester (MST). A test calls a server's tools (or sends any MCP request) directly through MST's fixtures and checks the result with its matchers, with no client or model involved. Use when asked to write MCP tests, test MCP tools, check tool responses, errors, schemas or snapshots, run conformance checks, or turn tool checks from a JSON file into tests.Other plugins' skills for the same job