eval-sample-size
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@eval-sample-size how many test cases do I need to tell 82% from 78% accuracy?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sample-size-mcp
How many test cases do you need to trust that model A is really better than model B?
Usually more than you'd think: telling 82% from 78% takes about 1,500 cases if the models' errors are unrelated. If both models run on the same test set, and they usually make the same mistakes, the number can drop to about 500. This tool does the math. You can use it as a CLI or as an MCP server, so an agent can check an eval before trusting it.
CLI
uv run evalsize n 0.82 0.78 # cases needed (same test set for both models)
uv run evalsize n 0.82 0.78 --discordance 0.10 # ...when the models disagree on 10% of cases
uv run evalsize n 0.82 0.78 --unpaired # each model gets its own sample
uv run evalsize gap 500 0.78 # smallest win 500 cases can detect
uv run evalsize compare 500 --a-only 41 --b-only 22 --both 360 # is this result real?$ uv run evalsize n 0.82 0.78 --discordance 0.10
489 test cases (shared by both models)
to detect 82.0% vs 78.0% (gap 4.0%) at alpha=0.05, power=80%
discordance 10.0% (given); ~49 cases will carry the signal
$ uv run evalsize compare 500 --a-only 41 --b-only 22 --both 360
A 80.2% vs B 76.4%: gap +3.8%, 95% CI [+0.7%, +6.9%], p=0.0226 -> SIGNIFICANTAll commands accept --alpha (false-positive rate, default 0.05) and --power (the chance of detecting a real gap, default 0.8).
Related MCP server: agent-eval
MCP server
{
"mcpServers": {
"eval-sample-size": {
"command": "uvx",
"args": ["--from", "git+https://github.com/fayehall-ai/sample-size-mcp", "sample-size-mcp"]
}
}
}Or with Claude Code: claude mcp add eval-sample-size -- uvx --from git+https://github.com/fayehall-ai/sample-size-mcp sample-size-mcp
Tools: eval_sample_size, eval_min_detectable_gap, eval_compare_paired, eval_compare_unpaired.
The statistics
Paired (the default) means both models are scored on the same cases. Cases where both models are right, or both wrong, tell you nothing about which model is better. Only the cases where they disagree count, so the required sample size depends on discordance: the fraction of cases where exactly one model is right. This tool uses McNemar's test, with sample size from Connor (1987):
n = (z_{α/2}·√ψ + z_β·√(ψ − δ²))² / δ² ψ = discordance, δ = accuracy gapIf you don't pass a discordance, the tool assumes the models' errors are independent, ψ = a(1−b) + b(1−a). That's the worst realistic case, and it needs about as many cases as the unpaired design. Real models usually fail on the same hard cases, so the true discordance is lower and you need fewer cases. Run a small pilot (~100 cases), measure how often the models disagree, and pass that number. This is usually the biggest lever you have.
Unpaired means each model is scored on its own random sample. This uses the two-proportion z-test (Fleiss formula, no continuity correction), and n is the number of cases per model.
Checking results: compare / eval_compare_paired uses the exact McNemar (binomial) test, with a Wald confidence interval on the gap.
Tests include a Monte Carlo check that the recommended n actually gives about 80% power. Run them with uv run pytest.
Caveats
Every test case counts as independent. If your cases come in clusters (several prompts per document, or several samples per prompt), you need more cases than this says.
Each test is a single comparison. If you compare many models or checkpoints, divide
alphaby the number of comparisons (Bonferroni correction).For accuracies close to 0 or 1, or very small samples, the normal approximation becomes rough.
Available Tools
4 toolseval_compare_pairedA
Is A's win over B on a shared test set statistically real?
n: total cases; a_only: A right & B wrong; b_only: B right & A wrong;
both: both right. Returns exact McNemar p-value and a CI on the gap.Inputs: n (required), both (required), a_only (required), b_only (required), +1 more.
eval_compare_unpairedC
Is A's win over B real when each was scored on a different sample? Two-proportion z-test with a CI on the gap.
Inputs: n_a (required), n_b (required), correct_a (required), correct_b (required), +1 more.
eval_min_detectable_gapC
Smallest accuracy improvement over baseline_acc that an eval with n test cases can reliably detect. Use this to sanity-check an existing eval set.
Inputs: n (required), baseline_acc (required), alpha, power, +2 more.
eval_sample_sizeA
How many test cases are needed to trust that model A's accuracy really differs from model B's.
acc_a, acc_b: expected accuracies as proportions (e.g. 0.82, 0.78).
paired: True if both models run on the same test cases (usual case).
discordance: paired only -- fraction of cases where exactly one model is
right. Measure it from a pilot run if you can; default assumes
independent errors, which overestimates n for similar models.
Inputs: acc_a (required), acc_b (required), alpha, power, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct statistical purpose: planning sample size, checking minimum detectable gap, paired comparison, and unpaired comparison. The paired vs. unpaired tests are explicitly distinguished by name and description, leaving little room for misselection.
All tools share the eval_ prefix and snake_case formatting, which provides a predictable namespace. However, the suffixes mix verb-led names (eval_compare_paired) with noun phrases (eval_sample_size, eval_min_detectable_gap), a minor inconsistency.
Four tools is well-scoped for a focused eval-statistics utility. Each tool covers a distinct and necessary part of sample-size planning and model comparison, with no redundant entries.
The surface covers the key lifecycle for eval statistical planning: determining required sample size, assessing detectable gaps, and comparing models under both paired and unpaired designs. No obvious gaps remain for the stated purpose.
Maintenance
Related MCP Connectors
Exact A/B test sample size, duration, z-test, chi-square, Fisher-Freeman-Halton and peeking risk.
Detect hiring adverse impact and estimate whether a selection method is worth its cost.
Exact statistics & probability: distributions, hypothesis tests, CIs, Bayesian updates, regression.
Tells you whether a trading strategy's edge is distinguishable from luck.
Related MCP Servers
- AlicenseAqualityCmaintenanceEval-integrity statistics for AI benchmark claims — multiple-testing correction, power/MDE for model gaps, judge-bias and leaderboard-rank checks. Catches a benchmark number that won't survive a second look.9MIT
- AlicenseAqualityBmaintenanceMCP server exposing statistical regression testing for LLM agents as a "run" tool: p-value, effect size, and confidence interval on whether agent behavior actually changed.168 PyPIApache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides a virtual statistician for AI agents, offering real statistical methods such as design of experiments, hypothesis testing, regression, and process control. It includes an advisor tool to recommend appropriate analyses and generates plain-language interpretations of results.MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables statistical A/B testing by computing Welch's two-sample t-test, Satterthwaite degrees of freedom, and two-tailed p-values, alongside time-series forecasting, anomaly detection, regression, and PCA through MCP tools.MIT