Skip to main content
Glama

chi_square_independence

Read-onlyIdempotent

Test if row and column variables in a contingency table are independent. Returns chi-squared statistic, p-value, and flags low expected counts.

Instructions

Test whether the row and column variables of a contingency table are independent (e.g. "does group membership relate to outcome?"). Returns the chi-squared statistic, degrees of freedom, p-value, a citation, and a warning if any expected cell count is below 5 (consider cramers_v afterwards for effect size).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alphaNosignificance level for the test (and any confidence interval); default 0.05
tableYescontingency table as a list of rows, each a list of raw counts (not proportions), e.g. [[treated_success, treated_failure], [control_success, control_failure]] for a 2x2 table

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv0.3.0
    • addedInput schema / properties / alpha / description
      Added value: +"significance level for the test (and any confidence interval); default 0.05"
    • addedInput schema / properties / table / description
      Added value: +"contingency table as a list of rows, each a list of raw counts (not proportions), e.g. [[treated_success, treated_failure], [control_success, control_failure]] for a 2x2 table"
  2. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the safety profile is covered. The description adds value by disclosing the exact return payload (chi-squared statistic, df, p-value, citation) and the warning behavior when any expected cell count is below 5, giving the agent behavioral expectations beyond the annotations.

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?

The description is two sentences, front-loaded with the core purpose, and every clause contributes: purpose, example, return values, assumption warning, and effect-size follow-up. There is no redundancy or 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 test with no output schema, the description covers purpose, returns, assumptions, and a recommended post-hoc measure. It does not explain the alpha parameter, but the schema's description already covers that, and the overall guidance is sufficient for an agent to invoke the tool correctly.

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 the schema already documents both parameters thoroughly. The description mentions contingency table concepts but does not add parameter-level detail beyond the schema's table example and alpha explanation; 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 clearly states the tool's verb and resource: 'Test whether the row and column variables of a contingency table are independent.' It includes an illustrative example ('does group membership relate to outcome?') and distinguishes this from sibling tests like chi_square_goodness_of_fit by focusing on contingency table independence.

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 provides clear usage context: use this when you have a contingency table and want to test independence. It also gives a follow-up recommendation ('consider cramers_v afterwards for effect size'), but it does not explicitly mention when not to use it or name alternatives, so it falls short of a full 5.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mrnh/rigor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server