Skip to main content
Glama

Stat Chi2 Mcnemar

stat_chi2_mcnemar

Runs McNemar's test to compare paired categorical outcomes, such as before/after or matched-pair data, by analyzing discordant pairs and returning the test statistic and p-value.

Instructions

McNemar's test — paired categorical data (before/after, matched pairs, twins).

WHEN TO USE: the same units contribute a categorical value under two conditions (pre/post intervention, two raters, matched pairs).

WHEN NOT TO USE: for independent groups — use stat_chi2_independence.

Only the two discordant cells contribute to the statistic.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "x": "<x>",
      "y": "<y>"
    },
    "name": "stat_chi2_mcnemar"
  }
}

Input Schema

NameRequiredDescriptionDefault
xYes
yYes
nameYes
correctionNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden. It discloses a key behavioral fact — only the two discordant cells contribute to the statistic — which is genuinely useful beyond a restatement of the test name. However, it says nothing about the correction default, permission/validation behavior, error conditions on unbalanced pairs, or output shape (the output schema covers the return value, so that is a lesser 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?

Four short lines, front-loaded with the test identity, then structured WHEN/WHEN NOT blocks, then a one-line statistical caveat. No filler sentences.

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

Completeness3/5

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

Because an output schema exists, return values need not be explained, and the design-level guidance is strong. The remaining gap is the complete silence on the four input parameters, including the non-obvious defaulted boolean 'correction', which an agent cannot safely set without inference.

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

Parameters2/5

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

Schema description coverage is 0% for four parameters (x, y, name, correction), and the description never mentions any of them. An agent must guess that x and y are the two paired measurement columns, that name labels the result, and that correction controls the continuity correction defaulting to true. Only the paired-data framing implicitly constrains x/y.

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?

Names the exact statistical procedure (McNemar's test) and its data shape (paired categorical, before/after, matched pairs) in the first line. This is a specific verb+resource statement that an agent can match to a research design without opening the schema.

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

Usage Guidelines5/5

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

Has explicit WHEN TO USE and WHEN NOT TO USE blocks with a named alternative (stat_chi2_independence) for the independent-groups case. Routing guidance is unambiguous.

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