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
service_versionYesDeployed Calcgrid implementation version used for the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / sample_a / maxItems
      Added value: +10000
    • addedInput schema / properties / sample_b / maxItems
      Added value: +10000
    • addedOutput schema / properties / service_version
      Added value: +{
      +  "description": "Deployed Calcgrid implementation version used for the result.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "success",
      -  "request",
      -  "result",
      -  "timestamp"
      -]New value: +[
      +  "success",
      +  "service_version",
      +  "request",
      +  "result",
      +  "timestamp"
      +]
  2. 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
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.8/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 substantial behavioral context: what it computes, the formulas used, the outputs returned, the decision at chosen alpha, and a direct REST fallback with a warning not to guess paths. This goes beyond the 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but extremely well-structured: front-loaded with purpose and usage, then detailed sections for inputs, valid combinations, examples, outputs, formulas, and fallback. Every section earns its place; there is no filler. The organization makes complex information easily navigable.

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?

This tool has 11 parameters, conditional schema requirements, and an output schema. The description covers valid combinations, provides examples, explains the statistical formulas, lists outputs, and even gives a REST fallback and docs link. Given the complexity, the description is remarkably complete; nothing an agent needs to call it correctly is missing.

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

Parameters5/5

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

Schema coverage is 100% (every parameter has a description), so the baseline is 3. However, the description adds significant value beyond the schema by explaining valid input combinations (one_sample, two_sample, paired), providing five complete JSON argument examples, and warning against mixing raw samples with summary fields. This greatly helps an agent construct correct 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 a sample mean against a hypothesized value, comparing two independent groups, or paired measurements. It explicitly names the three t-test variants (one-sample, Welch two-sample, paired) and differentiates from siblings by listing when NOT to use it (proportions, counts, 3+ groups, existing t/df). This is a specific verb+resource with clear sibling differentiation.

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 provides explicit 'Use this when' and 'Do not use this when' instructions, naming alternatives (proportion-z-test, chi-square-test, ANOVA, p-value tool). It also gives example user requests that illustrate the intended use cases. This is exemplary usage guidance.

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