Skip to main content
Glama

T-Test Calculator

calculate_t_test
Read-onlyIdempotent

Use this when you want to test whether a sample mean differs from a hypothesised value, whether two independent groups have different means, or whether paired before/after measurements changed. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.

Do not use this when the data are proportions or counts (use proportion-z-test or chi-square-test), you have three or more groups (ANOVA), or you already have t and df and only need the p-value (use p-value). What it computes: Runs a one-sample, Welch two-sample (unequal variances) or paired Student t-test from raw samples or summary statistics (mean, SD, n), returning t, degrees of freedom, two- and one-sided p-values, the confidence interval and the decision at the chosen alpha. Example user requests: Run a one-sample t-test for [102, 98, 105, 101, 104] against a mean of 100. | Compare two independent samples with Welch's t-test from their means, sample SDs and sample sizes. | Run a paired t-test on these before and after measurements in matching order. Inputs: mode (enum, optional); sample_a (number_list, optional); sample_b (number_list, optional); mean_a (number, optional); sd_a (number, optional); n_a (integer, optional); mean_b (number, optional); sd_b (number, optional); n_b (integer, optional); hypothesized_mean (number, optional); alpha (number, optional). Valid input combinations: one_sample: sample_a, or all of mean_a + sd_a + n_a. two_sample (also the default when mode is omitted): one complete raw-or-summary input for A and one for B. paired: both sample_a + sample_b, or paired-difference summary mean_a + sd_a + n_a. Do not mix a raw sample with its summary fields. Complete JSON argument examples: {"mode":"two_sample","sample_a":[5.1,4.9,5.6,5.8,6],"sample_b":[4.2,4.8,4.4,4.6,4.5]} | {"mode":"two_sample","mean_a":5.48,"sd_a":0.47117,"n_a":5,"mean_b":4.5,"sd_b":0.23452,"n_b":5} | {"mode":"one_sample","sample_a":[102,98,105,101,104],"hypothesized_mean":100} | {"mode":"paired","sample_a":[1.9,0.8,1.1,0.1,-0.1,4.4,5.5,1.6,4.6,3.4],"sample_b":[0.7,-1.6,-0.2,-1.2,-0.1,3.4,3.7,0.8,0,2]} | {"mode":"paired","mean_a":1.58,"sd_a":1.23042,"n_a":10} Outputs: test, mean_a, mean_b, mean_difference, standard_error, t_statistic, degrees_of_freedom, p_value_two_sided, p_value_one_sided, t_critical, ci_lower, ci_upper, significant, decision. Formula: one_sample: t = (x̄ − μ0) / (s / √n), df = n − 1. paired: same on the differences d = a − b. two_sample (Welch): t = (x̄a − x̄b − μ0) / √(sa²/na + sb²/nb), df = (sa²/na + sb²/nb)² / ((sa²/na)²/(na − 1) + (sb²/nb)²/(nb − 1)). p = P(|T_df| ≥ |t|); CI = estimate ± t(1 − alpha/2, df) × SE Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/t-test with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/statistics/t-test.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
n_aNoNumber of observations in A, or number of pairs.
n_bNoNumber of observations in B.
modeNoWhich t-test to run.two_sample
sd_aNoSample standard deviation (n − 1) of A, or of the paired differences.
sd_bNoSample standard deviation (n − 1) of B.
alphaNoSignificance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha.
mean_aNoSummary alternative to sample_a: sample mean of A (in paired mode: mean of the differences a − b).
mean_bNoSummary alternative to sample_b (two_sample only): sample mean of B.
sample_aNoRaw observations of the first (or only) sample. Alternatively give mean_a, sd_a and n_a.
sample_bNoRaw observations of the second sample (two_sample) or the paired partner values in the same order (paired). Alternatively give mean_b, sd_b and n_b.
hypothesized_meanNoNull-hypothesis value: the population mean (one_sample) or the mean difference (two_sample, paired). Usually 0 for differences.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linksNo
resultYes
requestYes
sourcesNo
successYes
versionNo
freshnessNo
timestampYes
next_actionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "mode": {
      +          "const": "one_sample"
      +        }
      +      },
      +      "required": [
      +        "mode"
      +      ]
      +    },
      +    "then": {
      +      "oneOf": [
      +        {
      +          "not": {
      +            "anyOf": [
      +              {
      +                "required": [
      +                  "mean_a"
      +                ]
      +              },
      +              {
      +                "required": [
      +                  "sd_a"
      +                ]
      +              },
      +              {
      +                "required": [
      +                  "n_a"
      +                ]
      +              }
      +            ]
      +          },
      +          "required": [
      +            "sample_a"
      +          ]
      +        },
      +        {
      +          "not": {
      +            "required": [
      +              "sample_a"
      +            ]
      +          },
      +          "required": [
      +            "mean_a",
      +            "sd_a",
      +            "n_a"
      +          ]
      +        }
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "mode": {
      +          "const": "paired"
      +        }
      +      },
      +      "required": [
      +        "mode"
      +      ]
      +    },
      +    "then": {
      +      "oneOf": [
      +        {
      +          "not": {
      +            "anyOf": [
      +              {
      +                "required": [
      +                  "mean_a"
      +                ]
      +              },
      +              {
      +                "required": [
      +                  "sd_a"
      +                ]
      +              },
      +              {
      +                "required": [
      +                  "n_a"
      +                ]
      +              }
      +            ]
      +          },
      +          "required": [
      +            "sample_a",
      +            "sample_b"
      +          ]
      +        },
      +        {
      +          "not": {
      +            "anyOf": [
      +              {
      +                "required": [
      +                  "sample_a"
      +                ]
      +              },
      +              {
      +                "required": [
      +                  "sample_b"
      +                ]
      +              }
      +            ]
      +          },
      +          "required": [
      +            "mean_a",
      +            "sd_a",
      +            "n_a"
      +          ]
      +        }
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "anyOf": [
      +        {
      +          "properties": {
      +            "mode": {
      +              "const": "two_sample"
      +            }
      +          },
      +          "required": [
      +            "mode"
      +          ]
      +        },
      +        {
      +          "not": {
      +            "required": [
      +              "mode"
      +            ]
      +          }
      +        }
      +      ]
      +    },
      +    "then": {
      +      "allOf": [
      +        {
      +          "oneOf": [
      +            {
      +              "not": {
      +                "anyOf": [
      +                  {
      +                    "required": [
      +                      "mean_a"
      +                    ]
      +                  },
      +                  {
      +                    "required": [
      +                      "sd_a"
      +                    ]
      +                  },
      +                  {
      +                    "required": [
      +                      "n_a"
      +                    ]
      +                  }
      +                ]
      +              },
      +              "required": [
      +                "sample_a"
      +              ]
      +            },
      +            {
      +              "not": {
      +                "required": [
      +                  "sample_a"
      +                ]
      +              },
      +              "required": [
      +                "mean_a",
      +                "sd_a",
      +                "n_a"
      +              ]
      +            }
      +          ]
      +        },
      +        {
      +          "oneOf": [
      +            {
      +              "not": {
      +                "anyOf": [
      +                  {
      +                    "required": [
      +                      "mean_b"
      +                    ]
      +                  },
      +                  {
      +                    "required": [
      +                      "sd_b"
      +                    ]
      +                  },
      +                  {
      +                    "required": [
      +                      "n_b"
      +                    ]
      +                  }
      +                ]
      +              },
      +              "required": [
      +                "sample_b"
      +              ]
      +            },
      +            {
      +              "not": {
      +                "required": [
      +                  "sample_b"
      +                ]
      +              },
      +              "required": [
      +                "mean_b",
      +                "sd_b",
      +                "n_b"
      +              ]
      +            }
      +          ]
      +        }
      +      ]
      +    }
      +  }
      +]
    • addedInput schema / description
      Added value: +"one_sample: sample_a, or all of mean_a + sd_a + n_a. two_sample (also the default when mode is omitted): one complete raw-or-summary input for A and one for B. paired: both sample_a + sample_b, or paired-difference summary mean_a + sd_a + n_a. Do not mix a raw sample with its summary fields."
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "mode": "two_sample",
      +    "sample_a": [
      +      5.1,
      +      4.9,
      +      5.6,
      +      5.8,
      +      6
      +    ],
      +    "sample_b": [
      +      4.2,
      +      4.8,
      +      4.4,
      +      4.6,
      +      4.5
      +    ]
      +  },
      +  {
      +    "mean_a": 5.48,
      +    "mean_b": 4.5,
      +    "mode": "two_sample",
      +    "n_a": 5,
      +    "n_b": 5,
      +    "sd_a": 0.47117,
      +    "sd_b": 0.23452
      +  },
      +  {
      +    "hypothesized_mean": 100,
      +    "mode": "one_sample",
      +    "sample_a": [
      +      102,
      +      98,
      +      105,
      +      101,
      +      104
      +    ]
      +  },
      +  {
      +    "mode": "paired",
      +    "sample_a": [
      +      1.9,
      +      0.8,
      +      1.1,
      +      0.1,
      +      -0.1,
      +      4.4,
      +      5.5,
      +      1.6,
      +      4.6,
      +      3.4
      +    ],
      +    "sample_b": [
      +      0.7,
      +      -1.6,
      +      -0.2,
      +      -1.2,
      +      -0.1,
      +      3.4,
      +      3.7,
      +      0.8,
      +      0,
      +      2
      +    ]
      +  },
      +  {
      +    "mean_a": 1.58,
      +    "mode": "paired",
      +    "n_a": 10,
      +    "sd_a": 1.23042
      +  }
      +]
  2. Added
  3. Removed
  4. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds behavioral detail: it specifies Welch's correction for unequal variances, describes the output fields (t, df, p-values, CI, decision), and notes the fallback REST endpoint and docs. This goes beyond 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 long but well-structured with clear sections: usage, exclusions, what it computes, example requests, inputs, valid combinations, examples, outputs, formula, fallback. The core usage is front-loaded. Some redundancy with schema examples exists, but each section serves a purpose and the length is justified by the tool's complexity.

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

Completeness5/5

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

For an 11-parameter tool with three modes and conditional requirements, the description is exceptionally complete. It covers valid combinations, provides examples for every mode, gives the formulas, lists output fields, and even includes a REST fallback and documentation link. An agent has everything needed to call it correctly without external lookup.

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% with descriptive parameter docs, so baseline is 3. The description adds meaningful semantics: it enumerates valid input combinations for each mode, clarifies that two_sample is the default, warns against mixing raw and summary fields, and provides complete JSON examples. This genuinely helps an agent construct valid calls.

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 precise statement of what the tool does: testing sample mean vs hypothesised value, two independent groups, or paired before/after measurements. It names the three t-test variants and clearly separates this from sibling calculators. Even without naming siblings, the purpose is unambiguous.

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?

The description explicitly states when to use the tool (the three scenarios) and when not to, naming specific alternatives: proportion-z-test, chi-square-test, ANOVA, and p-value for existing t/df. This gives an agent clear routing logic.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources