Skip to main content
Glama
theluckystrike

ab-test-sample-size-calculator-mcp

Fisher exact and Fisher-Freeman-Halton test

fisher_exact_test
Read-onlyIdempotent

Calculate exact p-values for contingency tables, including 2x2 Fisher and larger Fisher-Freeman-Halton tests, with chi-square diagnostics for low expected counts.

Instructions

Exact p-value for a contingency table of counts. 2x2: Fisher exact test (two-sided, greater or less, as R fisher.test). Larger r x c tables (for example 3 variants x converted/not, or 4 x 4 survey tables): Fisher-Freeman-Halton exact test by a network algorithm. Also returns Pearson chi-square and how many cells have expected counts below 5, so you can see when the chi-square approximation is unsafe.

Input Schema

NameRequiredDescriptionDefault
tableYesRows of counts, for example [[12, 488], [25, 475]] (rows = groups, columns = outcomes).
alternativeNoOne-sided options apply to 2x2 only; greater = odds ratio above 1.two-sided

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, so the safety bar is met; the description adds real behavioral context beyond them — the network algorithm used for large tables and the fact that Pearson chi-square plus a low-expected-count tally are returned alongside the exact p-value. It does not describe error behavior for invalid tables (e.g. fewer than 2 rows), a minor gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the core purpose and then branching by input shape, followed by the secondary return values. No filler and nothing repeated from the schema or annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description compensates by naming the returned quantities (exact p-value, Pearson chi-square, count of low-expected cells). For a two-parameter pure-computation tool, an agent has everything needed to call it and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both 'table' and 'alternative' are already documented in structured data, including the enum and its 2x2-only restriction. The description's 'two-sided, greater or less, as R fisher.test' adds only a mild semantic anchor, which fits the baseline-3 case where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource: exact p-value for a contingency table of counts, then splits the behavior by table shape (2x2 → Fisher exact, r x c → Fisher-Freeman-Halton). An agent can tell immediately what statistical output this produces and for which input shape.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 2x2 vs larger-table routing rule is explicit, and the note that expected counts below 5 signal 'chi-square approximation is unsafe' gives the agent a decision criterion for choosing this over approximate methods. It stops short of naming a specific sibling (e.g. test_ab_significance) as an alternative, so it is clear context without explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.