Skip to main content
Glama

Stat Chi2 Independence

stat_chi2_independence

Tests independence between two categorical variables from independent observations via chi-square, reports Cramér's V effect size, and flags cells with expected counts below 5.

Instructions

Chi-square test of independence between two categorical variables.

WHEN TO USE: two categorical variables from independent observations.

WHEN NOT TO USE

  • The same participants measured twice on a categorical variable → stat_chi2_mcnemar.

  • Any expected cell count < 5 → Fisher's exact test (the tool flags this).

Report Cramér's V as the effect size.

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_independence"
  }
}

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, so the description carries the full burden. It usefully discloses that the tool flags expected cell counts below 5 and recommends reporting Cramér's V, but says nothing about the default continuity correction being applied, whether that changes the statistic, or what errors occur on non-categorical input.

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?

Front-loaded purpose sentence followed by labeled WHEN TO USE / WHEN NOT TO USE blocks. Every line is actionable; no filler.

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?

Output schema exists, so return values need not be described, and the routing guidance is strong. The gap is parameter explanation: for a 4-parameter call with zero schema coverage, an agent cannot confidently map `correction` or `name` without a docstring or guessing.

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% across 4 parameters. The description implies x and y are the categorical variables, but never says they are column names, never explains what `name` is for, and never explains that `correction` toggles Yates' continuity correction despite defaulting to true.

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 and resource: 'Chi-square test of independence between two categorical variables.' It is immediately distinguishable from stat_chi2_mcnemar and other siblings.

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?

Explicit WHEN TO USE condition (two categorical variables, independent observations) and a WHEN NOT TO USE block naming the correct alternative (stat_chi2_mcnemar for repeated measures) and the Fisher's exact fallback for small expected counts.

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