Skip to main content
Glama

mcnemar_exact_test

Read-onlyIdempotent

Run an exact binomial test on discordant pairs in paired 2x2 data to compare correlated proportions, providing a small-sample-safe alternative to the chi-squared approximation.

Instructions

Exact version of mcnemar_test: an exact binomial test (p=0.5) on the discordant pairs instead of the chi-squared approximation -- the small-sample-safe alternative mcnemar_test's own warning points to, the same relationship fisher_exact_test has to chi_square_independence. statistic is b-c (the raw discordant-pair imbalance); the p-value is two-tailed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alphaNosignificance level for the test (and any confidence interval); default 0.05
tableYes2x2 table as [[a, b], [c, d]], same layout as mcnemar_test -- raw non-negative integer counts

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish read-only, idempotent, non-destructive behavior. The description adds meaningful statistical behavior beyond that: it specifies the exact binomial test with p=0.5, defines the statistic as b-c, and states that the p-value is two-tailed. This goes well beyond the structured annotations without contradicting them.

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

Conciseness4/5

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

The description is compact and front-loaded with the core purpose, and the additional clauses about the p-value and statistic are all informative. It is somewhat dense with parentheticals and a long analogy, but no sentence is filler.

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

Completeness4/5

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

For a statistical tool with no output schema, the description provides the essential context: exact vs approximate behavior, the statistic definition, and p-value tailedness. It does not fully enumerate the return object structure, but the combination of schema, annotations, and description is sufficient for correct invocation.

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?

Input schema coverage is 100%, with both alpha and table already described in the schema. The tool description does not add extra parameter-level semantics; the b-c comment relates to the statistic rather than to either input parameter. Given full schema coverage, baseline 3 is appropriate.

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?

The description identifies a precise function: an exact binomial McNemar test on discordant pairs, and contrasts it with the approximate mcnemar_test. It also names the analogous relationship between fisher_exact_test and chi_square_independence, which clearly distinguishes the tool from relevant siblings.

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 description explicitly frames this as the small-sample-safe alternative that mcnemar_test's warning points to, giving an agent a clear condition for choosing it. It also draws an analogy to fisher_exact_test vs chi_square_independence, but it does not fully spell out when the approximate version would be preferred instead.

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