Skip to main content
Glama

sw_sample_size

Determine required sample size for an experiment from standard deviation and expected effect. Alternatively, compute the minimum detectable effect for a given sample size.

Instructions

样本数该定多少 —— 算出来的,不是问用户的

蒙特卡洛跑多少次,取决于想检出多大的效应和逐样本差值有多离散::

N ≥ ( (1.96 + 0.84) · σ_d / Δ )^2

三种用法:

  • std_diffexpected_effect → 返回需要的样本数;

  • std_diffn_current → 返回这个实验最小能检出多大效应。 这个数比样本数更该先看:它比期望增益还大时,实验无论跑出什么结果 都不足以下结论;

  • 什么都不给 → 返回试点流程(先跑 20 个样本量方差)。

std_diffsw_compare_armspaired.std_diff 取。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
std_diffNo
n_currentNo
expected_effectNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations provided, the description carries the transparency burden and does well: it discloses the formula, the three behavioral branches, and the pilot behavior of running 20 samples. It does not explicitly state side effects or return format, but since this is a calculation tool and an output schema exists, the disclosure is adequate.

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 structured with a formula, bullet points, and a bolded warning. Every sentence adds value: the formula, three usage modes, the caution about MDE, and the source of std_diff. It is longer than minimal but appropriately detailed for a tool with three distinct operational modes.

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?

Given the tool has an output schema and no annotations, the description covers all needed context: mathematical methodology, all three usage scenarios, the pilot fallback, and a caution about interpreting results. It is complete for the tool's complexity.

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 description coverage is 0%, so the description must compensate. It explains all three parameters: std_diff is sourced from sw_compare_arms paired.std_diff, expected_effect is the target effect size for sample size calculation, and n_current is used to compute minimum detectable effect. It also explains the no-arguments case, making parameter semantics clear.

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 computes required sample size or minimum detectable effect based on statistical parameters, with the opening '算出来的,不是问用户的' and three explicit usage modes. This distinguishes it from sibling tools like sw_plan or sw_compare_arms, which have different purposes.

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?

It provides explicit when-to-use guidance for all three parameter combinations: with std_diff+expected_effect, with std_diff+n_current, and with none. It also tells users to check the minimum detectable effect first and points to where std_diff comes from (sw_compare_arms paired.std_diff), fully covering usage context.

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

Install Server

Other Tools

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/TianLin0509/superwireless'

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