Skip to main content
Glama

Sample Size

sample_size
Read-onlyIdempotent

Calculate the survey sample size needed for a confidence level and margin. FREE.

Uses maximum variance (p=0.5) with a finite-population correction when population is given. Typical input {"population": 5000, "confidence_pct": 95, "margin_pct": 5} returns {"required_sample": 357, "assumptions": "p=0.5 (max variance), random sampling"}.

Use before collecting data, to size a survey. Not for analyzing data already collected (stats_describe, confidence_interval). Errors: on invalid, missing, or malformed input this tool never raises a protocol error; it returns {"error": ""} (for example {"error": "confidence_pct must be 90, 95, or 99"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.

Input Schema

NameRequiredDescriptionDefault
margin_pctNoAcceptable margin of error percentage; above 0 and at most 50. Default 5.
populationNoTotal population size; 0 (default) means unknown or very large.
confidence_pctNoConfidence level; must be 90, 95, or 99. Default 95.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description still adds real behavioral context: no protocol errors are ever raised, failures come back as {"error": ...} with a fix hint, and retry is always safe after correction. It also discloses the statistical assumptions (p=0.5 max variance, finite-population correction), which annotations cannot convey.

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?

Front-loaded with the verb and purpose, followed by method, usage routing, and error semantics in a logical order. The inline example input/output pair is longer than strictly necessary for a tool with an output schema, but it is illustrative rather than repetitive.

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 a three-parameter statistical calculator with an output schema, everything an agent needs is present: semantics, assumptions, error contract, idempotent retry guidance, and sibling routing. Return-value explanation is redundant given the output schema but harmless.

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; the description earns above that by giving a concrete typical input and by surfacing a constraint via the error example ('confidence_pct must be 90, 95, or 99') plus the p=0.5 assumption and finite-population-correction caveat. It stops short of explaining how population=0 interacts with the correction.

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?

Opens with a specific verb+resource ('Calculate the survey sample size') and immediately scopes it to confidence level and margin. It also names the siblings it is not (stats_describe, confidence_interval), so an agent can route between them without opening a schema.

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 ('Use before collecting data, to size a survey') and when-not ('Not for analyzing data already collected'), with the two competing siblings named as the alternatives. This is exactly the when/when-not/alternative structure.

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.