Skip to main content
Glama

confidence_interval

Calculate confidence intervals for a numeric column using t-distribution or bootstrap median, with customizable confidence level.

Instructions

confidence_interval —— 统计推断组 · 置信区间(工具 10,核心实现)。

docstring = agent 使用说明书,与 statlab_mcp/docs/design/03_inference_batch1.md 同步维护。

参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) column (str): 分析列(须为数值列) confidence (float, 0.95): 置信水平 ∈ (0,1) method (str, "mean_t"): mean_t / bootstrap_median mean_t: mean ± t_{1-α/2, n-1} * sd/√n(sd 用 ddof=1,与 describe 同口径) bootstrap_median: 局部 default_rng(42) 重采样 1000 次取中位数,2.5%/97.5% 分位数(percentile 法)——每次调用独立可复现(不依赖全局 rng 状态)

边界: n<3 / confidence 越界 / method 非法 / 非数值或缺列 —— 中文报错; 常数列(sd=0)区间退化为点并注明。

示例: confidence_interval("samples/clean.csv", column="income") confidence_interval("samples/clean.csv", column="income", confidence=0.90, method="bootstrap_median") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnNo
methodNomean_t
file_pathNo
confidenceNo
inline_dataNo

Schema Changelog

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

  1. First observedv1.2.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations provided, the description bears the full burden of behavioral disclosure, and it does so thoroughly: ddof=1 for sd, deterministic default_rng(42) with 1000 resamples, percentile method, reproducibility independent of global RNG, Chinese error messages, and degenerate point intervals for constant columns. This is far beyond a minimal purpose statement.

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 organized into parameter, boundary, example, and inline-data sections, making it skimmable and largely information-dense. A small amount of noise comes from the meta sentence about docstring/design-doc synchronization and from repeating schema defaults.

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?

It covers input selection, method math, defaults, error conditions, degenerate cases, and reproducibility, which is enough for an agent to invoke the tool correctly. The main gap is that it does not describe the return object structure, and there is no output schema to compensate.

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 prose must explain all parameters, and it does: file_path accepted formats, column numeric requirement, confidence in (0,1), method choices with formulas, and inline_data's two accepted shapes. It also communicates the mutual exclusion between file_path and inline_data.

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 explicitly identifies this as the confidence-interval tool for the statistical inference group and defines the two supported methods with formulas (mean_t and bootstrap_median), so an agent can determine exactly what computation is performed. It is unambiguous and detailed even though it does not contrast with siblings.

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 usage context: when to use file_path vs inline_data, valid method choices, boundary conditions, and error cases. However, it does not explicitly state when confidence_interval should be chosen over related siblings like hypothesis_test or effect_size, so an explicit exclusion/alternative statement is missing.

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/good-boy4069/statlab-mcp'

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