Skip to main content
Glama
Ian3738
by Ian3738

test_categorical

Test categorical data with chi-square independence, goodness-of-fit, or McNemar, including effect sizes and plots. Automatically switches to Fisher's exact for small samples.

Instructions

Tests for categorical data. With x and y: a chi-square test of independence with the contingency table, expected counts, standardised residuals, Cramer's V, and - for 2x2 tables - the odds ratio, risk ratio and phi. Fisher's exact test is added automatically when expected counts are too small. With x only: a goodness-of-fit test against expected_probs (uniform by default). Set test='mcnemar' for paired binary data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesFirst categorical column.
yNoSecond categorical column; omit for a goodness-of-fit test.
dataYesDataset name in the session.
testNoauto, chisq, fisher or mcnemar.auto
plotsNoInclude a mosaic or bar plot.
digitsNoDecimal places.
correctNoApply Yates' continuity correction to 2x2 tables.
expected_probsNoExpected proportions per level for a goodness-of-fit test; one value per level.

Schema Changelog

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

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses automatic Fisher's exact test selection when expected counts are too small, lists the computed statistics, and notes default uniform probabilities. It stops short of explaining plot behavior or data requirements, but it is substantially transparent.

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 compact, front-loaded, and every sentence earns its place by explaining a distinct usage mode or automatic behavior. There is no repetition of schema content and no 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 tool with 8 parameters, no annotations, and no output schema, the description covers the main decision paths and expected outputs. Minor gaps remain around plot output and data preparation, but the schema handles parameter formats and the description handles behavior.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds meaning by linking x and y to specific test variants and expected_probs to goodness-of-fit. This cross-parameter context goes beyond the individual property descriptions.

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 opens with a specific verb and resource ('Tests for categorical data') and then enumerates distinct analyses: chi-square independence, goodness-of-fit, and McNemar. This clearly differentiates it from sibling statistical tools like test_ttest or correlation.

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?

It gives clear conditions: use x and y together for independence tests, x alone for goodness-of-fit, and test='mcnemar' for paired binary data. It does not explicitly name sibling tools or state when not to use it, but the categorical-data framing and conditional branches provide solid usage context.

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/Ian3738/r-stats-mcp'

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