statlab-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@statlab-mcp帮我分析 sales.csv 的描述统计和缺失值情况"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
statlab-mcp — Statistical Analysis MCP Server
Standalone project, not affiliated with any vendor's official plugin (README historical note: not affiliated with DeepSeek Harness). Gives AI agents (Claude Code / Cursor / DeepSeek Harness / Codex, etc.) real statistical capability: LLMs computing statistics by mental math will fabricate numbers; every statistical result in this project comes from real computation (numpy / scipy / statsmodels / scikit-learn / pmdarima), the AI only handles invocation and interpretation; no LLM is allowed to participate in computation within the first layer of 25 tools.
What it's for
After installing it, when you tell the AI "help me analyze this sales data", the AI no longer makes groundless assertions — it calls 25 real statistical tools: compute descriptive statistics, check correlations, run hypothesis tests, fit regressions, perform clustering, forecast time series, draw Chinese charts — every number comes from a validated statistical library, reproducible and accountable. The summary field gives a one-sentence Chinese conclusion, and result gives the full structured data, e.g.:
{"status": "ok", "result": {"p_value": 0.0241, "mean_diff": 5.5, "effect_size": 0.65},
"summary": "Welch t 检验:均值差 5.5(95% CI [0.74, 10.26]),p=0.0241 <0.05 拒绝 H0……相关≠因果"}Related MCP server: shewhart-mcp
Who it's for
Audience | How to use | Benefit |
People writing code / doing analysis with AI (data analysts, operations, product) | Have Claude Code / Cursor etc. call it on demand | Analysis conclusions are backed by real computation, no more worrying about AI fabricating numbers |
AI Agent developers | Plug it in as a statistics backend into your own agent/workflow | 25 deterministic tools + unified protocol, easy to integrate and test |
People who studied statistics but don't want to hand-code | Ask in natural language, AI calls the tools on their behalf | Hypothesis testing / regression / time series fully auto-selected, with step-by-step explanations |
People who need accountable analysis reports | Combine with the auto_analysis scheme (decision tree + template + prompt) | Every number in the report is tagged with its source tool, guarding against hallucination |
Students who want to quickly chart their data | A set of plot_* tools | Chinese-labeled charts with statistics marked directly on the plot |
What problems it solves
Your problem | Corresponding capability |
"What does this pile of data look like, is it dirty" | describe / data_type_check / missing_report: physical exam, household register, absence sheet |
"Are those two columns related? Real or coincidence" | correlation_matrix (with fdr_bh multiple-comparison correction) + heatmap |
"Is there really a difference between group A and group B" | normality_test → hypothesis_test (Welch t) → effect_size triple |
"How much of the sales difference across three stores is real" | anova_test: automatic Levene→Welch→Tukey/Games-Howell post-hoc comparison |
"What drives revenue? Can it be predicted" | linear_regression (R²/VIF/residual diagnostics) + feature_importance |
"Will a new customer buy (yes/no)" | logistic_regression: OR + AUC + confusion matrix + separation warning |
"How many segments can customers be split into?" | cluster_analysis (centroids restored to original units + silhouette coefficient k±1 comparison) |
"About how much will sales be next month?" | trend_analysis → time_series_forecast (SARIMA auto order selection) |
"Which day in this date series is off" | anomaly_detect (STL/differenced IQR/rolling z-score, only reports, never deletes data) |
"I don't want to look at tables, I want charts and reports" | plot_* five-piece set + auto_analysis report template |
Features and standout capabilities
Determinism above all: all random processes fixed with seed (42); running the same file twice yields byte-for-byte identical results (this is the foundation of accountability, with dedicated assertions in tests)
Anti-hallucination design: the first layer of 25 tools has zero LLM involvement; conclusion copy is generated by code templates assembling numbers; p<0.001 is uniformly shown as "<0.001"; every conclusion is accompanied by a fixed limitations statement (correlation ≠ causation, whether corrected, sample size)
Caliber locked down and recomputable: q1/q3 = linear interpolation (same caliber as Excel QUARTILE.INC), skewness/kurtosis = scipy Fisher caliber, std = ddof=1 (Excel STDEV.S) — documented in writing, tests cross-check against manual formulas and standard libraries independently (223 pytest cases, coverage in docs/)
Full Chinese pipeline: Chinese column names, automatic GBK encoding fallback, Chinese-font charts (falls back to English with a note when no font is available), Chinese error messages with solution suggestions
Hardcore security and protection: local files only, rejects UNC/NUL paths, no network upload, triple protection at >50MB / 2 million rows / 500MB memory, xlsx zip-bomb and date-span protection, error output capped (prevents malicious input from hanging the process)
Uniform calling experience: all tools are isomorphic (
parameter validation → Chinese error or result+summary), so both agents and humans pick it up painlessly; MCP tool descriptions = full docstring (parameter tables/return structure/examples), when the agent opens the tool list, that is the user manualEngineering completeness: 12 design documents (per-tool parameter tables/boundary tables/JSON Schema/validation methods) + client integration configs + coverage of 82–96% + full ruff pass + stdio protocol smoke test
Quick start
# 1. 安装(Python 3.13+,仅 pip)
git clone https://github.com/good-boy4069/statlab-mcp.git
cd statlab-mcp
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt --timeout 60
# 2. 验证能跑(应输出 ALL-STDIO-OK)
$env:PYTHONUTF8="1"
.\.venv\Scripts\python.exe tests\smoke_stdio.pyConnect to Claude Code (project root .mcp.json):
{
"mcpServers": {
"statlab-mcp": {
"command": "C:\\path\\to\\statlab-mcp\\.venv\\Scripts\\python.exe",
"args": ["-m", "statlab_mcp.server"],
"cwd": "C:\\path\\to\\statlab-mcp",
"env": {"PYTHONUTF8": "1"}
}
}
}Three musts:
-m statlab_mcp.server(not the server.py path),cwdpointing to the project root, andPYTHONUTF8=1. Other clients (Cursor/VSCode/Codex/Hermes/DSH) seedocs/clients.md.
First call (usable directly from the command line without a client):
.\.venv\Scripts\python.exe -c "import sys; sys.path.insert(0,'.'); from statlab_mcp.tools.data_exploration_describe_statistics import describe_statistics; import json; print(json.dumps(describe_statistics('samples/clean.csv'), ensure_ascii=False, indent=1))"Three iron rules for data: ① only csv/xlsx/tsv/json accepted, absolute paths freely given (Chinese/GBK/empty values/invalid dates all handled automatically); ② put real data outside the project directory; ③ for every statistic, first read the plain-Chinese conclusion in summary, then flip through the structured numbers in result.
The 25 tools at a glance
Group | Tools |
Data exploration | describe_statistics, correlation_matrix, missing_report, outlier_detect, data_type_check |
Statistical inference | hypothesis_test, anova_test, chi_square_test, normality_test, confidence_interval, effect_size |
Modeling | linear_regression, logistic_regression, cluster_analysis, pca_analysis, feature_importance |
Time series | time_series_forecast, seasonal_decompose, trend_analysis, anomaly_detect |
Visualization | plot_scatter, plot_histogram, plot_heatmap, plot_forecast, plot_box |
Orchestration layer | auto_analysis (deliverable: decision-tree document + report template + agent prompt, not an MCP tool) |
Core value and unified protocol
Accountable numbers: results are deterministic, reproducible, and testable; the same input run twice gives identical results (global seed=42)
Unified structure: success
{status:"ok", result:{...}, summary:"one-sentence Chinese conclusion"}; failure{status:"error", message:"Chinese reason with a useful hint"}Image attachments: image-bearing tools attach
__image__at the top level of the returned JSON (absolute image path, base64 forbidden)
Environment preparation (Windows)
Requires Python 3.13+, a dedicated virtual environment (pip only; uv/poetry/conda forbidden):
python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt --timeout 60requirements.txt is the single authoritative source for dependencies (pyproject.toml holds only metadata).
UTF-8 must be set before running (otherwise stdio writes Chinese JSON in GBK and the MCP connection breaks immediately):
$env:PYTHONUTF8="1"As a fallback, the server entry file also has
sys.stdout.reconfigure(encoding="utf-8")at the very top.Data reading uniformly goes through the
read_table()wrapper: utf-8-sig trial read → on csv/tsv failure automatically switch to gbk → on further failure a Chinese error "file encoding unrecognized, please save as UTF-8"; format whitelist {csv, xlsx, tsv, json}, xlsx reads only the first sheet.
How agents view images
DeepSeek Harness: use the
read_imagetool to read the absolute path returned by__image__Claude Code: use the
Readtool to read the same pathAll images are stored in
reports/plots/YYYYmmdd/(archived by date to prevent buildup), filenamestoolname_<primary column name or all>_YYYYmmdd_HHMMSS_fff.png, Chinese fonts Microsoft YaHei/SimHei (falls back to English with an in-chart note when missing), dpi=150; the directory may be cleaned at any time (does not affect any computation)
Security statement
Only analyzes locally provided data files that you actively hand over; rejects UNC/NUL paths; no network uploads whatsoever
Path trust statement: tools do not verify file provenance (they read directly from the path you give), so do not pass paths from untrusted sources; put real data outside the project directory
Big-data protection: >50MB rejected; 5–50MB first estimates row count/memory and rejects if over limit; zip bombs and date-span attack surfaces also hard-protected
Testing and acceptance
& .\.venv\Scripts\python.exe -m pytest tests\ -qTest data is generated by
tests/make_fixtures.pywith fixed seed and committed to the repo; key numbers are cross-checked against independent third-party computation (statistics.mean / manually computed expected-value tables) — no circular reasoning allowedAcceptance workflow (AI-assisted mode since 2026-08-26): full pytest pass + real-run verification on two datasets (full real stdout archived in the acceptance record) → commit + PROGRESS entry; users retain the right to spot-check at any time
Quality baseline: 223 pytest cases, tool module coverage 82–96%, full ruff pass, stdio protocol smoke ALL-STDIO-OK
Technical notes (mcp 2.x)
Dependency pinned to mcp==2.1.0: mcp.server.fastmcp.FastMCP has been superseded by mcp.server.mcpserver.MCPServer
(API-compatible add_tool/tool decorators; list_tools/call_tool/run_stdio_async are async).
Documentation navigation
docs/clients.md— client integration configs (Claude Code/Cursor/VSCode/Codex/Hermes/DSH)docs/SPEC.md— protocol and statistical calibers (return structure/number protocol/image protocol/behavior contract)docs/design/— interface design for each tool (parameter tables/boundary behavior tables/JSON Schema/validation methods, the user manual for agents and secondary developers)docs/example_report.md— example report for auto_analysis scheme A (a demonstration of the anti-hallucination iron rules)
Directory structure
statlab_mcp/ # server.py(只注册工具+to_jsonable)+ tools/<组>_<工具>.py
docs/ # SPEC.md(协议与统计口径)、design/(各工具接口设计文档)、clients.md(接入配置)
samples/ # 入库样例数据 + 生成脚本
tests/ # pytest + fixtures 生成脚本
data/ # 使用者亲手造的测试数据(gitignore,不入库)
reports/plots/ # 图片输出(gitignore,按日期归档可随时清理)License
MIT (Copyright © 2026 周翔宇).
Available Tools
30 toolsanalysis_planA
analysis_plan —— 编排层 · 分析计划生成(工具 30,v1.2.0 方案 B 落地)。
把 design/08 决策树变成 100% 确定性规则工具:显式关键词表 + 列类型规则 + 表序优先级, 零 LLM、零模糊匹配;只出计划不执行(执行由外层 agent 逐步调用第一层工具)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/11_analysis_plan.md 同步维护。
参数: question (str): 必填,非空自然语言问题(空白/控制字符 → E1001) file_path (str|None): 可选数据源(与 inline_data 二选一,用于结构感知; 双缺合法 → data_aware=false、data_source=null;双给 → E1001) inline_data (list|dict|None): 内联小数据(同 file_path 二选一规则) column_hints (dict[str,str]|None): {"列名": "数值|类别|日期"} 显式类型覆盖; 值域非法 → E1001;引用不存在列 → 忽略并在 summary 注明
意图表(12 个,忠实转录 design/08 表格 11 行+头部功效路由;完整词表见 design/11): 概览/相关/类别关联/单组均值/两组比较/多组比较/预测连续/预测是否/分群/ 趋势预测/异常检测/样本量功效。多意图命中 → 按 08 表格行序取先者; 全部未命中 → fallback 计划(数据概览三件套+如实告知),不猜测任何方法。
返回: result = {intent, data_aware, data_source, chosen_methods:[{tool, reason_code, matched_keywords}], tool_calls_plan:[{step, tool, params, depends_on, needs?}], report_template:[五章], limitations:[四条]}。 summary 模板:"已生成分析计划:N 步,首选方法 X;计划由确定性规则生成, 执行请逐步调用对应工具"。
示例: analysis_plan("这两个门店的销量差多少是真实的", file_path="sales.csv") analysis_plan("帮我看看这堆数据长什么样", inline_data={"header":["v"],"rows":[[1]]})
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | ||
| file_path | No | ||
| inline_data | No | ||
| column_hints | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and discharges it richly. It discloses deterministic rule-based behavior ('零 LLM、零模糊匹配'), fallback plan when no intent matches, multi-intent priority by table order, specific error codes (E1001) for invalid inputs, and the behavior of ignoring invalid column_hints references while noting them in the summary.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but well-structured with clear sections for parameters, intent table, return value, and examples. Most content earns its place; minor meta-information like 'v1.2.0 方案 B 落地' and '与 statlab_mcp/docs/design/11_analysis_plan.md 同步维护' is useful context but not strictly needed for invoking the tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity, the absence of an output schema, and zero schema descriptions, the description is remarkably complete. It covers all parameters, the full intent list, fallback behavior, the result structure with keys like chosen_methods and tool_calls_plan, a summary template, and two representative examples. An agent has enough to select and call this tool correctly without external documentation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 fully. It explains each parameter's meaning, requiredness, mutual exclusivity constraints, valid value domains for column_hints ('数值|类别|日期'), and error behavior for invalid values. This goes well beyond the raw type-only schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens by identifying the tool as an orchestration-layer analysis plan generator ('编排层 · 分析计划生成') and immediately clarifies it converts a decision tree into a deterministic rule tool that '只出计划不执行' (only plans, does not execute). This clearly distinguishes it from all the sibling execution tools like hypothesis_test, linear_regression, and describe_statistics, which actually perform the analyses.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives strong usage boundaries: it is for generating plans, execution is left to the outer agent calling first-layer tools, and it documents parameter preconditions (question required, file_path/inline_data mutually exclusive, both missing is legal, both provided triggers E1001). It stops short of naming specific sibling alternatives for when-to-use-not, but the orchestration-versus-execution contrast is explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
anomaly_detectA
anomaly_detect —— 时序组 · 时序异常检测(工具 20,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) date_col / value_col (str): 日期列与数值列 method (str, "stl"): stl / iqr / rolling_zscore stl: statsmodels STL(robust=True) 残差 |resid| > threshold残差标准差 (std(ddof=1) 判据;MAD_std=1.4826median|resid-median| 对"主体集中+ 稀疏厚尾"残差低估尺度,实现期修订弃用,见 statlab_mcp/docs/design/06) iqr: 一阶差分上 IQR 规则(Q1-1.5IQR / Q3+1.5IQR,同探查组口径), threshold 参数不参与 iqr 判据,索引映射回原行 rolling_zscore: 窗口 7 滚动 mean/std(min_periods=3),|z| > threshold threshold (float, 3.0): >0;仅 stl 与 rolling_zscore 使用
保证: 异常点仅报告不剔除;常数序列(尺度 0)无异常并注明。
示例: anomaly_detect("samples/timeseries.csv", date_col="date", value_col="value") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | stl | |
| date_col | No | ||
| file_path | No | ||
| threshold | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description fully carries the behavioral disclosure burden. It explicitly guarantees that anomalies are only reported and not removed, documents constant-series behavior, states that threshold is ignored for IQR, and discloses method-specific criteria such as rolling window sizes and index remapping. This is substantially more than the schema or annotations reveal.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well structured with headers, bullets, and a front-loaded purpose, but it is longer than necessary. Internal maintenance notes, doc-sync statements, and deprecation rationale go beyond what is needed for tool selection and invocation, even though most content is technically relevant.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Input formats, method behavior, and inline-data alternatives are well covered, which is enough to invoke the tool correctly. However, there is no output schema and the description never explains the return value structure, so an agent cannot fully anticipate how anomaly results will be represented.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage, yet the description thoroughly explains all parameters: file_path, date_col/value_col, method variants, threshold semantics and defaults, plus inline_data accepted shapes and the file_path/inline_data exclusivity. It fully compensates for the empty schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as time-series anomaly detection and names the concrete methods (STL, IQR, rolling z-score). It is scoped to the time-series group and a simple example shows the intended call shape, which distinguishes it from generic outlier detection or statistical test siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives rich parameter-level guidance but no explicit guidance on when to choose anomaly_detect over sibling tools such as outlier_detect. There is no when-to-use/when-not-to-use statement or discussion of alternatives, so an agent must infer usage context from the domain label and method list.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
anova_testA
anova_test —— 统计推断组 · 方差分析(工具 7,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/04_inference_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) group_col (str): 分组列(类别或数值均可,按唯一值分组;2~20 组) value_col (str): 数值列(检验对象) alpha (float, 0.05): 显著性水平 ∈ (0,1)
流程(确定性): 1. 前置:Levene 方差齐性(scipy.stats.levene,稳健中位数版)+ 各组 Shapiro (3<=n<=5000 时执行,违反警示不阻断) 2. 方差齐 -> scipy.stats.f_oneway;方差不齐(Levene p<alpha)-> Welch ANOVA (statsmodels.stats.oneway.anova_oneway(use_var="unequal"),避免手写公式出错) 3. 事后:齐 -> Tukey HSD(statsmodels pairwise_tukeyhsd,含 p 值与族校正); 不齐 -> Games-Howell(手写:libqsturng.qsturng 学生化极差临界值, se=sqrt(si2/ni+sj2/nj),显著判定 = |diff| > q*se/sqrt(2); p 值省略并以"CI 是否含 0"判定,输出注明——statsmodels 无现成实现,诚实披露)
示例: anova_test("samples/clean.csv", group_col="category", value_col="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| alpha | No | ||
| file_path | No | ||
| group_col | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full behavioral burden and succeeds: it discloses a deterministic procedure, exact library calls, post-hoc method selection, and a known limitation (Games-Howell p-values omitted, CI-only judgment, '诚实披露'). It also states that assumption violations warn but do not block execution.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with clear sections: parameters, deterministic flow, example, and inline data. It is longer than typical, but the length is justified by the complexity of the statistical behavior and the implementation details needed for correct invocation.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers data formats, parameter constraints, algorithm fallbacks, post-hoc details, inline_data modes, and example usage, making it nearly complete for invocation. It does not spell out the full return object (e.g., F-statistic, p-value fields) and does not explicitly mark group_col/value_col as required, which matters given there is no output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description compensates fully by defining every parameter: file formats for file_path, grouping semantics and the 2–20 group bound for group_col, numeric requirement for value_col, alpha ∈ (0,1), and the two accepted shapes of inline_data plus the one-of constraint with file_path.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description leads with '方差分析' (ANOVA) and '统计推断组', naming the exact statistical operation and grouping it among inference tools. The detailed procedure (f_oneway, Welch, Tukey, Games-Howell) distinguishes it clearly from sibling tests like chi_square_test, nonparametric_test, and hypothesis_test.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides clear usage context: compare a numeric value across 2–20 groups, with explicit prerequisites (Levene, Shapiro) and automatic selection of classic vs Welch ANOVA. It does not explicitly name alternative tools and the conditions for choosing them, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
backtest_forecastA
backtest_forecast —— 时序组 · 滚动回测(工具 29,v1.2.0 新增)。
time_series_forecast 的可信度自评:滚动窗口回测输出 MAE/RMSE/MAPE, 让预测结论自带"历史表现"背书。前置处理与 forecast 完全同口径 (_prepare_series 五项统一前置),逐窗独立重放以杜绝真值泄漏 (验证窗不含任何由未来观测构造的插值点——design/06 防泄漏节)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径 date_col (str): 日期列;value_col (str): 数值值列(语义与 time_series_forecast 一致) horizon (int): 每窗验证段长度,1 <= horizon <= 有效样本×50%(E1001) windows (int, 3): 回测窗口数,1..10(auto_arima 每窗一次拟合,防耗时爆炸;E1001) method (str, "auto_arima"): auto_arima / naive / seasonal_naive (两个 naive 基线为封闭公式,用于对照;seasonal_naive 的周期逐窗取 _estimate_period,不可估或 > 训练段长时退化为 naive 并记 period_used_fallback)
门槛链(校验顺序红线 D9): 参数合法 → n>=30(低于报错 E1010)→ n >= horizon*(windows+1) 且 train_min = n - windowshorizon >= max(15, 2period_full_est)(E1010 带调参建议) → n<=100000(E1005 防大表卡顿)→ 逐窗计算。
指标: 每窗口逐点 pred/actual/abs_err + 汇总 MAE/RMSE/MAPE; 真实值含 |actual|<=1e-12 时该窗口 MAPE=null 并注明 zero_note(禁止除零假值)。 明细总量上限 10000 点,超出截断最旧窗并记 truncated=true(汇总永不截断)。
局限声明(固定附于 summary 末尾):回测表现不代表未来;未做外部验证。
示例: backtest_forecast("samples/clean.csv", "date", "score", horizon=3) backtest_forecast("samples/clean.csv", "date", "score", horizon=2, windows=2, method="naive") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | auto_arima | |
| horizon | No | ||
| windows | No | ||
| date_col | No | ||
| file_path | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool performs multiple model fits, has a 10000-point result cap with truncation, reports MAPE=null for near-zero actuals, and appends a limitations disclaimer. It also reveals internal details like _prepare_series and leakage prevention. This is exceptional transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but densely packed with valuable information, organized with clear headers (参数, 门槛链, 指标, 局限声明, 示例). It front-loads the core purpose before diving into details. Some redundancy exists (e.g., E1001 mentioned twice), and the docstring maintenance note is meta-information that could be trimmed, but every section earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 7 parameters, no output schema, no annotations, and a complex statistical tool, this description covers validation rules, output metrics, error codes, edge cases, and usage examples. It even addresses potential concerns like computational cost and data leakage. This is as complete as a text description can reasonably be.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 each parameter with types, defaults, constraints, and semantic alignment with time_series_forecast. For method, it enumerates all three options and their behaviors. The only minor gap is that inline_data's exact shape is deferred to SPEC.md, but the description gives enough context to use it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description begins with a clear statement: '时序组 · 滚动回测' and immediately explains it is a rolling-window backtest for time_series_forecast, computing MAE/RMSE/MAPE. It distinguishes itself from the sibling time_series_forecast by emphasizing it provides '历史表现' credibility. The purpose is specific and unmistakable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states this tool is for validating time_series_forecast, and notes it shares preprocessing with forecast. It provides parameter constraints, validation thresholds (E1010, E1005), and even notes inline_data is an alternative to file_path. It gives explicit examples and explains fallback behavior for seasonal_naive. This is comprehensive usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
chi_square_testA
chi_square_test —— 统计推断组 · 卡方独立性检验(工具 8,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/04_inference_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) col_a / col_b (str): 两列类别变量(均须存在;数值列自动等宽分箱 ≤8 箱并注明)
流程(确定性): 1. 分类化:数值列 pd.cut 等宽分箱(箱数=min(8, max(2, 唯一值数)))并注明; 类别唯一值 =1 -> error;>50 -> error(防列联表爆炸) 2. pd.crosstab 列联表;scipy.stats.chi2_contingency(含期望频数表) 3. >20% 单元格期望频数 <5:2x2 -> scipy.stats.fisher_exact(statistic=OR、df=null); 非 2x2 -> 中文报错引导合并类别 4. 效应量 Cramér's V = sqrt(chi2/(n*(min(rows,cols)-1)))(chi2 来自 chi2_contingency, fisher 路径同样给出并注明基于卡方近似) 5. 结论固定模板;summary 注明"关联≠因果"
示例: chi_square_test("samples/clean.csv", col_a="category", col_b="category") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| col_a | No | ||
| col_b | No | ||
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden and exceeds it: deterministic pipeline, binning rule, error conditions for unique values, Fisher exact fallback with OR/df=null, Cramér's V formula, expected-frequency caveat, and the 'association ≠ causation' warning. An agent can predict side effects and failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose, parameters, deterministic flow, example, and inline-data note are laid out in a logical, front-loaded order with negligible redundancy. The only nonoperational sentence is the docstring-synchronization maintenance note, preventing a perfect 5.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite no annotations and no output schema, the description covers input constraints, preprocessing, test selection, effect size, edge-case errors, conclusion template, and caveats. It even names the statistics an agent can expect in the result (chi2, expected frequencies, OR, df, Cramér's V).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and has four nullable params with no descriptions. The tool description documents file formats for file_path, the mutual exclusivity and two accepted shapes of inline_data, and the required existence plus auto-binning behavior for col_a/col_b. This is exactly the operational semantics the schema lacks.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific statistical operation ('卡方独立性检验') and a specific resource (association between two categorical columns), immediately distinguishing it from generic inference siblings. The example call and the '两列类别变量' requirement make the scope unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives clear input context: two categorical columns are needed, numeric columns get auto-binned, and file_path/inline_data are mutually exclusive. However, it never explicitly says when to prefer this tool over siblings such as nonparametric_test or correlation_matrix, so alternative routing is left to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cluster_analysisA
cluster_analysis —— 建模组 · KMeans 聚类(工具 14,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/05_modeling.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) k (int): 簇数,2 <= k <= 样本数-1(非法中文报错)
口径: 仅数值列(非数值列自动排除并列出);StandardScaler z-score 标准化后 KMeans(n_clusters=k, random_state=42, n_init="auto");质心反标准化回原始单位 (标准化空间质心即簇内均值,反标准化后 = 原空间簇均值,可手算核对); 质心解读强制附簇内样本量;轮廓系数(标准化空间)+ k-1/k+1 同 seed 对照。
示例: cluster_analysis("samples/clean.csv", k=3) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so extensively: it states that only numeric columns are used, non-numeric columns are excluded and listed, StandardScaler z-score normalization is applied, KMeans is run with fixed random_state and n_init, centroids are inverse-transformed, cluster sizes must accompany centroid interpretation, and silhouette scores are computed with k-1/k+1 comparisons. This gives the agent a clear, detailed picture of the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized into labeled sections for parameters, methodology, example, and inline data, making it scannable. Some content is meta or redundant, such as the docstring-sync note and 'tool 14' identifier, but the overall structure earns its length by providing substantive algorithm and usage detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is largely complete for selecting and invoking the tool: it explains the parameters, gives a working example, and describes the preprocessing and model configuration. However, it does not explicitly describe the return format/structure of the results, and it defers some inline-data limits to an external SPEC document, which may not be accessible to the agent at invocation time.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides almost no semantic detail (0% coverage), but the description compensates fully: file_path supports csv/tsv/xlsx/json, k must satisfy 2 <= k <= sample_count-1 with error handling, and inline_data supports two concrete shapes and is mutually exclusive with file_path. Each parameter gets meaningful guidance beyond the bare type declarations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as KMeans clustering for modeling tasks, which goes beyond the generic name 'cluster_analysis' by naming the exact algorithm. It also differentiates from sibling modeling tools like linear_regression, pca_analysis, and hypothesis_test. However, it does not phrase the purpose as a direct agent-facing action or explicitly state what kind of output the tool produces.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides an example and states the algorithm configuration, but it never tells the agent when to choose this tool over alternatives or when not to use it. There is no explicit mention of use cases, comparisons to sibling tools, or exclusion conditions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
confidence_intervalA
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 节。
| Name | Required | Description | Default |
|---|---|---|---|
| column | No | ||
| method | No | mean_t | |
| file_path | No | ||
| confidence | No | ||
| inline_data | No |
TDQS
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.
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.
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.
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.
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.
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.
correlation_matrixA
correlation_matrix —— 数据探查组 · 相关矩阵(工具 4,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/02_data_exploration_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径 method (str, "pearson"): pearson / spearman / kendall / kendalltau(逐对取 scipy, 返回对象取 .statistic/.pvalue;pandas corr 无 p 值故不用;kendall 为 kendalltau 的官方别名 v1.1.0 起,两者结果完全相同) p_adjust (str, "fdr_bh"): none / bonferroni / fdr_bh;默认 BH-FDR 并标注; 校正单元 = 实际可计算的上三角对数(常量列对 r/p=null 不参与校正) (statsmodels.multipletests)
返回: 成功 {"status":"ok","result":{...},"summary":"..."};失败 {"status":"error",...} result: {method, n_pairs, p_adjust_method, excluded_columns, correlation, p_value, n_pairwise}(嵌套全矩阵;对角 r=1.0、p=null; 常量列对 r/p=null;n_pairwise 为成对完整样本量)
口径(红队裁决 11):每对成对完整样本;常量列 r/p=null 不参与校正; 数值列 >20 拒绝;排除非数值/全缺失列后 <2 列拒绝;p<0.001 只出现在 summary 文案。
示例: correlation_matrix("samples/clean.csv") correlation_matrix("samples/clean.csv", method="spearman", p_adjust="none") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | pearson | |
| p_adjust | No | fdr_bh | |
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the full behavioral burden, and it does so extensively: scipy pairwise .statistic/.pvalue, pandas corr rejected for lacking p-values, kendall/kendalltau alias behavior, BH-FDR correction on computable upper-triangle pairs, constant-column nulls, and numeric-column error thresholds. It also discloses the success/error response envelope.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is organized into labeled sections—params, return, 口径, examples, inline_data—and most content is operational detail earned by the absence of annotations and output schema. Meta sentences like 'docstring = agent 使用说明书' and '红队裁决 11' add maintenance context rather than invocation value, so it is not zero-waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
It covers all essential invocation information: complete result structure, null semantics, correction unit, pairwise-complete handling, method aliases, examples, and rejection conditions. The only material deferral is inline-data scale/type rules pointed to an external SPEC document, which may not be available to the agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and there are no enums, so the description is the only source of parameter meaning. It documents all four parameters with formats, allowed values, defaults, and side effects, including inline_data's two accepted shapes and mutual exclusivity with file_path.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies the tool as a correlation matrix in the data-exploration group and details its method options and result fields (correlation, p_value, n_pairwise), so the tool's job—computing pairwise correlation matrices—is clear. It lacks an explicit verb like 'calculates' and does not state how it differs from siblings such as plot_heatmap or hypothesis_test, so it stops just short of the highest tier.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended use is implied by the tool's placement in the data-exploration group and by constraints like '数值列 >20 拒绝' and '<2 列拒绝', which tell an agent when the input is unsuitable. It never explicitly states when to choose correlation_matrix over a sibling tool and gives no alternatives or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
data_type_checkA
data_type_check —— 数据探查组 · 列类型识别(工具 2,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/01_data_exploration_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径(拒绝 UNC)
返回: 成功 {"status":"ok","result":{...},"summary":"一句话中文结论"} 失败 {"status":"error","message":"中文原因"} result: {n_rows, n_columns, columns: {<列名>: {detected_type, n_valid, n_missing, dirty_count, note}}, issue_summary: {mixed_columns, fully_missing_columns, invalid_date_columns}}
判定树(确定性代码;实现期修订 vs 设计文档:数值先于日期,防 "123" 被 to_datetime 误认成日期;mixed 定义 = 数值或日期转换成功数在 (0, 95%) 区间,全部失败则按 category/text 处理): 1. 全缺失列 → missing(不参与任何转换) 2. pandas 数值 dtype → numeric;值全为整数 → integer 3. object 列先试 to_numeric(errors="coerce"):成功 ≥95% → numeric (有失配时 dirty_count=失败数,note 给脏值示例;全成功且全整数 → integer) 4. 未过数值,再试 to_datetime(errors="coerce"):成功 ≥95% → date (失配 = 非法日期,如 2024-02-30,记 dirty_count 并在 note 列示例) 5. 部分可转(成功数在 (0, 95%))→ mixed(两种转换都失败的值 = 脏值) 6. 完全不可转:唯一值 ≤ min(50, 行数×20%) → category(note 给 top3) 否则 → text
示例: data_type_check("samples/dirty.csv") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With zero annotations, the description carries the full burden and meets it thoroughly: it discloses a deterministic six-branch decision tree with exact thresholds (95% conversion success, min(50, rows×20%)), the numeric-before-date ordering rationale, dirty_count semantics, invalid-date handling (2024-02-30), success/error envelope shapes, and the UNC-path rejection. Even the implementation-vs-design-doc deviation is flagged so the agent is not misled.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but densely structured into labeled sections (参数/返回/判定树/示例/inline 数据) with the purpose front-loaded in the first line. The decision tree and return schema earn their length because they encode observable behavior an agent needs to predict outputs; the only mild waste is meta-maintenance prose about doc-sync and the external SPEC.md cross-reference.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex classifier with a bare schema (no param descriptions, no enums, no output schema, no annotations), the description is essentially self-sufficient: it documents the full nested result structure, all six classification outcomes with thresholds, both input modes, and an example call. The only residual ambiguity is whether at least one of file_path/inline_data is required, since both schema properties are nullable — a minor edge case.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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, and it does exhaustively: file_path gets supported formats (csv/tsv/xlsx/json), a local-only constraint, and UNC rejection; inline_data gets mutual exclusivity with file_path, both accepted shapes (records array or {header, rows} object), a version marker (v1.2.0), and a pointer to SPEC.md §12 for limits. Both parameters gain operational meaning the bare schema cannot convey.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a precise verb+resource statement — "数据探查组 · 列类型识别" (data exploration group · column type identification) — and reinforces it with a complete decision tree classifying columns as numeric/integer/date/mixed/category/text. This clearly distinguishes it from siblings like describe_statistics, missing_report, and correlation_matrix, which profile data along different axes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The "数据探查组 · 工具 2" header plus the detailed detection semantics imply this is an exploration-stage tool used before statistical analysis, but no sentence explicitly states when to choose it over a sibling or when not to use it. There is no alternative routing toward describe_statistics, missing_report, or analysis_plan, so the agent must infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_statisticsA
describe_statistics —— 数据探查组 · 描述性统计(工具 1,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/01_data_exploration_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径(拒绝 UNC)
返回: 成功 {"status":"ok","result":{...},"summary":"一句话中文结论"} 失败 {"status":"error","message":"中文原因"}(error 时无 result 字段) result 结构见设计文档「工具 1」JSON Schema: {n_rows, n_columns, numeric_columns, non_numeric_columns, fully_missing_columns, columns: {<列名>: {n, mean, median, std, min, q1, q3, max, skew, kurtosis, n_missing}}}
统计定义(SPEC 裁决,测试断言口径): - 分位数 q1/q3 = linear 插值(=Excel QUARTILE.INC),Series.quantile 默认即 linear; - std 用 ddof=1(=Excel STDEV.S); - skew = scipy.stats.skew(x, bias=False)(Fisher 样本偏度); - kurtosis = scipy.stats.kurtosis(x, fisher=True, bias=False)(超额峰度,正态=0)。
边界语义(使用者已裁决): - 全缺失列:n=0、n_missing=总行数、其余统计键全 null,不中断整表; - 常数列(std=0):skew/kurtosis=null(方差为 0 无法定义); - n<2:std/q1/q3=null;n<3:skew/kurtosis=null; - 非数值列忽略统计并列入 non_numeric_columns。
示例: describe_statistics("samples/clean.csv") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full responsibility and delivers thoroughly: local-path-only restriction, UNC rejection, success/error shapes, exact statistical definitions (linear q1/q3, ddof=1, scipy skew/kurtosis), and edge-case semantics for missing/constant/small/non-numeric columns. This makes runtime behavior highly predictable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but organized into labeled sections (parameters, returns, definitions, edge cases, example, inline data), and the detail is largely earned because there is no output schema or annotations. Some meta text like 'docstring = agent 使用说明书' is unnecessary, keeping it just below top tier.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
It covers input formats, return schema, error shape, statistical formulas, and edge cases, which is substantial for a complex tool without annotations or an output schema. It falls short of 5 only by referencing external docs for inline-data size limits/type domains and lacking an explicit selection policy.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Both parameters are given meaning far beyond the bare schema: file_path is restricted to local csv/tsv/xlsx/json paths (UNC rejected), and inline_data is described as a mutually exclusive alternative supporting records arrays or {header, rows} objects. Size limits/type domains are deferred to SPEC.md, so it is not perfectly self-contained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as '数据探查组 · 描述性统计' and details its output schema (n_rows, n_columns, per-column statistics), so an agent can tell it computes descriptive statistics. It is clear on action and resource, but it never names sibling tools or explicitly states what it is not (e.g., not a hypothesis test), so it misses the strongest differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It implies usage via '数据探查组' and an example invocation, and explains file_path vs inline_data mutual exclusivity, but it gives no explicit when-to-use vs alternatives or exclusions. An agent must infer when descriptive statistics is appropriate rather than a hypothesis test or correlation analysis.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
effect_sizeA
effect_size —— 统计推断组 · 效应量(工具 11,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/04_inference_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) group_col (str): 分组列(须恰好 2 组) value_col (str): 数值列 method (str, "cohens_d"): cohens_d / hedges_g / cliff_delta paired (bool, False): True 时两组样本数必须相等,按"各自有效值序列的 第 i 个"配对(简化语义:无 ID 列时的确定性约定,见设计文档)
口径: cohens_d: |m1-m2|/pooled_sd(pooled_sd 同 hypothesis_test) hedges_g: d * (1 - 3/(4(n1+n2)-9))(小样本修正) cliff_delta: delta = (gt-lt)/(n1n2),gt/lt 为所有跨组值对比较计数(numpy 向量化, 不依赖 mannwhitneyu 的 U 定义,避免方向歧义) CI: 正态近似 se(d/g: sqrt(1/n1+1/n2+d^2/(2(n1+n2)));cliff: sqrt((1-delta^2)/(n1n2))), mean ± 1.96*se;输出注明"正态近似" 阈值(标注为经验惯例):d/g 0.2/0.5/0.8(Cohen);cliff 0.147/0.33/0.474(Romano)
【简化】略过声明: 无 bootstrap CI、无分布假设检验、cliff_delta 无配对版本。
示例: effect_size("samples/clean.csv", group_col="category", value_col="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | cohens_d | |
| paired | No | ||
| file_path | No | ||
| group_col | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burden and does so thoroughly. It discloses exact formulas, normal-approximation CI construction with 1.96*se, explicit labeling of '正态近似', empirical thresholds, simplifications (no bootstrap CI, no distribution tests, cliff_delta lacks a paired version), and the deterministic paired-matching semantics without ID columns.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is dense and information-rich, with formulas, defaults, simplification notes, and an example all earning their place. It is long but well organized by labeled sections. Minor verbosity exists around docstring maintenance references and the inline_data section, which could be tightened without losing value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity, six parameters, no output schema, and no annotations, the description is nearly complete: it covers inputs, method semantics, constraints, and output caveats. The main gap is that it does not explicitly specify the shape or keys of the returned result object, only indicating that the CI will be labeled as '正态近似'.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must and does fully compensate. Every parameter is explained: file_path and inline_data are explicitly alternatives, group_col and value_col have constraints, method lists valid options with defaults, and paired describes the equality requirement and matching convention. This goes well beyond the bare schema types.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as an effect-size calculator for statistical inference, and lists the supported methods (cohens_d, hedges_g, cliff_delta) plus the input roles (group_col, value_col). It is specific about what the tool computes, though it does not explicitly contrast itself with sibling tools such as hypothesis_test or nonparametric_test.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives operational constraints (e.g., group_col must have exactly 2 groups, paired samples must have equal sizes) and notes simplification choices, but it provides no explicit guidance on when to choose this tool over alternatives like hypothesis_test, anova_test, or confidence_interval. The usage context is implied rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
feature_importanceA
feature_importance —— 建模组 · 特征重要性(工具 16,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/05_modeling.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) target (str): 目标列(<=20 类 -> 分类随机森林 class_weight=balanced;连续 -> 回归森林) method (str, "permutation"): permutation(打乱验证集特征,验证集思想)/ impurity(训练集内基尼/方差减少;两者都输出,默认 permutation) n_estimators (int, 200): 森林树数 >=10 random_state (int, 42): 森林与划分固定种子 n_repeats (int, 10): permutation 专用,打乱次数 >=1
硬性门槛: n < 50 拒绝(规格);特征重要性排序 + "重要性≠因果"尾注。
第 4.1 条实现(确定性): train_test_split(0.25, random_state) 划分;模型在训练集拟合;impurity 取 feature_importances_;permutation 在测试集上打乱(sklearn.inspection.permutation_importance)。
示例: feature_importance("samples/clean.csv", target="income") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | permutation | |
| target | No | ||
| file_path | No | ||
| n_repeats | No | ||
| inline_data | No | ||
| n_estimators | No | ||
| random_state | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and is substantially transparent: it discloses train_test_split(0.25, random_state), fitting on the training set, permutation on the test set, impurity via feature_importances_, balanced class weights, fixed seeds, and the 'importance≠causality' footer. It does not explicitly state whether the tool has side effects or auth requirements, but the detailed computational behavior makes its functioning clear.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well structured into parameter documentation, hard threshold, implementation details, example, and inline-data guidance. It is long but most sentences carry useful information; only the maintenance note and external SPEC.md pointer add limited direct invocation value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is rich and includes an example, thresholds, and algorithm details, but it leaves some important gaps: the schema marks all parameters optional yet the description never explicitly states that file_path or inline_data and target are required. With no output schema, the return format is only vaguely described as a ranking plus footnote, and some constraints are deferred to an external SPEC.md that an MCP agent may not access.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description compensates thoroughly: every parameter has type, default, and semantic constraints, e.g., n_estimators>=10, n_repeats>=1, method choices, and inline_data forms including mutual exclusivity with file_path. This is far more than the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as computing feature importance via random forest, with explicit classification vs regression behavior and an output of feature-importance ranking plus a causality footnote. It is specific about the resource and operation, though it does not explicitly distinguish itself from sibling modeling tools such as linear_regression or pca_analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied by the name and description, and the tool gives internal guidance such as choosing permutation vs impurity and treating targets with <=20 classes as classification and continuous targets as regression. However, it does not explicitly say when to choose this tool over sibling alternatives, nor does it state when not to use it apart from the n<50 rejection threshold.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
hypothesis_testA
hypothesis_test —— 统计推断组 · 假设检验(工具 6,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/03_inference_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) column (str): 分析列(须为数值列) test (str, "one_sample"): one_sample / independent / paired group_col (str|None): test=independent 时必填,须恰好 2 组且每组 n>=2 sample2_col (str|None): test=paired 时必填(与 column 成对对齐) mu0 (float, 0.0): one_sample 的 H0 假设均值 alternative (str, "two_sided"): two_sided / less / greater alpha (float, 0.05): 显著性水平 ∈ (0,1)
方法(设计文档口径): one_sample -> scipy.stats.ttest_1samp;independent -> ttest_ind(equal_var=False) (Welch's t,规格硬性规定,df 用 Welch-Satterthwaite 公式手算,跨版本稳定); paired -> ttest_rel(差值 = column - sample2_col,成正态预检对象)。 检验前 Shapiro 预检(3<=n<=5000):违反只警示不阻断,可转用 nonparametric_test (Wilcoxon/Mann-Whitney)。 CI 一律双侧(1-alpha,t 分布);效应量 Cohen's d(单样本|mean-mu0|/sd、 独立 pooled sd、配对差值 sd)。结论文案固定模板 p<alpha 拒绝 H0 / p>=alpha 不能拒绝。
示例: hypothesis_test("samples/clean.csv", column="score", test="one_sample", mu0=70.0) hypothesis_test("samples/clean.csv", column="score", test="independent", group_col="category") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| mu0 | No | ||
| test | No | one_sample | |
| alpha | No | ||
| column | No | ||
| file_path | No | ||
| group_col | No | ||
| alternative | No | two_sided | |
| inline_data | No | ||
| sample2_col | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and delivers: it discloses Welch's t-test as a hard specification with Welch-Satterthwaite df, the Shapiro pre-check for 3<=n<=5000 that warns but does not block, always two-sided CI construction, Cohen's d formulas per design, and the exact conclusion wording template. This is exceptional disclosure of statistical behavior beyond what any structured field could convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but well-sectioned into parameters, methods, examples, and inline-data notes, with critical constraints front-loaded and worked usage examples included. It loses a point for meta-content that doesn't help invocation, such as the doc-sync maintenance note and the deferral of inline_data limits to an external SPEC.md section.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 9-parameter tool with no annotations and no output schema, the description covers parameters, statistical methods, pre-check behavior, fallback paths, output highlights (CI, Cohen's d, conclusion template), and examples. The remaining gaps are the absence of a full result-structure specification and error-handling behavior, plus reliance on external docs for inline_data limits.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must fully compensate, and it does: every one of the 9 parameters is documented with types, defaults, and constraints (column must be numeric, group_col exactly 2 groups with n>=2, alpha in (0,1), sample2_col paired-aligned). It even documents inline_data's two accepted shapes and its mutual exclusivity with file_path, which the bare array/object union in the schema leaves opaque.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening line identifies it as "统计推断组 · 假设检验(工具 6,核心实现)" — a hypothesis testing tool in the inference group — and the body enumerates the three supported variants (one_sample, independent, paired) with their statistical methods. This clearly separates it from sibling tools like normality_test, anova_test, and chi_square_test, which address different inferential questions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives concrete selection context: group_col is required and must have exactly 2 groups for independent, sample2_col for paired, and mu0 for one_sample. It also explicitly names nonparametric_test (Wilcoxon/Mann-Whitney) as the fallback when the Shapiro pre-check is violated. It stops short of full when-not routing against siblings like anova_test for 3+ groups, so it earns 4 rather than 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
impute_missingA
impute_missing —— 数据探查组 · 缺失值插补(工具 28,v1.2.0 新增)。
与 missing_report 互补的确定性整治工具:只做规则插补(mean/median/ffill/bfill/constant), 不做任何"智能推断";绝不修改输入文件,插补结果写入 reports/imputed/ 新 CSV 并以 output 返回绝对路径(SPEC 第 11 节文件输出协议)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/01_data_exploration_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径 columns (list[str]|None): 待插补的数值列清单;缺省 = 全部含缺失的数值列 (显式传入时逐列校验:不存在 → E1008;非数值列含 object 伪数值列 → E1009) strategy (str, "mean"): mean / median / ffill / bfill / constant; mean/median 仅基于有限观测计算(±Inf 不算缺失也不计入均值——排除数进 result) value (float|None): 仅 strategy="constant" 时必填的填充值(有限数, 拒绝 NaN/Inf/bool);其它策略携带本参数 → E1001
边界(钉死): - 无任何可插补对象 → E1012 中文报错,三种情形 message 独立: 全表无缺失 / 指定列均无缺失 / 缺失仅位于非数值列; - 列全缺失且策略为 mean/median/ffill/bfill 时无来源可用 → 该列跳过原样保留, 在 result.skipped_columns 与 summary 如实注明(不报错);constant 对全缺失列生效; - 输出文件 = reports/imputed/YYYYmmdd/impute_missing_<干名>_<策略>_YYYYmmdd_HHMMSS_fff.csv (utf-8-sig;Excel 公式注入转义与控制字符清洗见 SPEC 第 11 节第 5 条)。
返回: 成功 result 含 {columns_processed:[{column,strategy,filled,value_or_direction, excluded_nonfinite,residual_missing}], skipped_columns:[...], output_dir} + 顶层 output = 插补文件绝对路径。 局限声明(固定附于 summary 末尾):插补值为确定性规则估计,会低估方差、可能引入偏差, 后续分析请注明使用了插补数据。
示例: impute_missing("samples/dirty.csv") # 默认全部数值缺失列、均值 impute_missing("samples/dirty.csv", columns=["score"], strategy="median") impute_missing("samples/dirty.csv", columns=["note"], strategy="constant", value=0) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| value | No | ||
| columns | No | ||
| strategy | No | mean | |
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
没有 annotations,描述承担了全部行为披露义务:明确“绝不修改输入文件”、输出写入 reports/imputed/ 并返回绝对路径、全缺失列会跳过并如实记录、文件写入有 utf-8-sig 和公式注入转义、固定附加局限声明。这些信息远超基本说明,行为非常透明。
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
描述结构清晰,按功能、参数、边界、返回、示例分段,信息密度高且可读性强。扣一分是因为夹杂了“工具 28”“docstring 同步维护”等元信息,对工具调用本身不是必须,略有冗余。
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
在无输出 schema、无 annotations、5 个参数且行为复杂的条件下,描述覆盖了参数语义、返回结构、错误码、边界行为、输出路径、局限声明和示例,足以让 agent 无需查阅额外资料即能正确调用并预期结果。
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
schema 描述覆盖率为 0%,描述完全补偿了参数语义:逐一解释了 file_path、columns、strategy、value、inline_data 的含义、默认值、约束和错误码,还说明了 mean/median 对 ±Inf 的处理及 constant 与 value 的依赖关系,比 schema 本身给出更多可操作信息。
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
描述首句明确点名“缺失值插补”和“数据探查组·确定性整治工具”,指出处理对象是缺失值、方法是规则插补、输出是新 CSV,并与 missing_report 明确区分。工具用途一眼可辨,不会与同组分析/绘图类工具混淆。
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
描述明确指出 missing_report 是互补工具,且限定“只做规则插补,不做智能推断”,等于给出了使用边界;还在参数部分说明了 file_path 与 inline_data 二选一、value 仅在 constant 策略下使用,提供了清晰的选型和使用条件。
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
linear_regressionA
linear_regression —— 建模组 · 线性回归(工具 12,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/05_modeling.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) target (str): 连续因变量(数值列) features (list[str]): 自变量(数值列直用;类别列自动 one-hot 并输出映射) add_constant (bool, True): 是否加截距(False 时 GOF 指标参考意义受限,注明) alpha (float, 0.05): 显著性阈值(报告用,∈(0,1))
口径: statsmodels OLS 矩阵接口(禁 formula);类别列 get_dummies(drop_first=False) + 映射; 零方差列自动剔除并报告;缺失 listwise dropna 并注明"已剔除 N 行"; n <= 设计矩阵列数+2 拒绝(无法稳定估计);VIF>10 标注强共线性; 残差 Shapiro + Durbin-Watson;残差诊断图(残差vs拟合 + 直方图,image 顶层)。
示例: linear_regression("samples/clean.csv", target="income", features=["age"]) linear_regression("samples/clean.csv", target="score", features=["age", "category"]) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| alpha | No | ||
| target | No | ||
| features | No | ||
| file_path | No | ||
| inline_data | No | ||
| add_constant | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden and does so thoroughly: it discloses statsmodels OLS matrix interface (no formula), one-hot encoding with drop_first=False plus mapping output, zero-variance column removal, listwise dropna with row-count reporting, rejection when n is too small, VIF>10 flagging, residual diagnostics, and top-level __image__ plots.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is organized into clear labeled sections (参数, 口径, 示例, inline 数据) and is dense with useful information. Minor overhead exists in maintenance notes like 'docstring = agent 使用说明书...' and '工具 12,核心实现,' which do not help an agent invoke the tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex modeling tool with no output schema and no annotations, the description is highly complete: parameter semantics, edge-case behavior, examples, and inline_data support are all covered. It does not define the full return-object shape, but it names key outputs (GOF, VIF, residual diagnostics, image placement) well enough for invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description compensates fully by documenting all six parameters: file formats for file_path, continuous-target constraint for target, one-hot behavior for features, add_constant consequence for GOF, alpha threshold semantics, and the inline_data record/header-rows shapes with a file_path/inline_data mutual-exclusion rule.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies the tool as '线性回归' using statsmodels OLS, with a continuous dependent variable (target) and feature list, which clearly conveys a model-fitting operation. It does not explicitly contrast itself with sibling logistic_regression, but the '连续因变量(数值列)' constraint implies the intended use case.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is implied through parameter semantics ('target (str): 连续因变量' and '类别列自动 one-hot'), and examples show typical calls. However, there is no explicit when-to-use/when-not-to-use guidance or mention of alternatives such as logistic_regression, leaving the agent to infer selection criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
logistic_regressionA
logistic_regression —— 建模组 · 逻辑回归(工具 13,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/05_modeling.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) target (str): 二分类目标列(恰好 2 类;类名映射为 0/1 输出 label_mapping) features (list[str]): 数值特征(本工具不做 one-hot,规格未要求;非数值报错) test_size (float, 0.3): train/test 分层划分比例 ∈(0,1) random_state (int, 42): 划分与复制的固定随机种子 class_weight (str, "balanced"): balanced 用少数类确定性复制实现(statsmodels Logit 无内置类权重,如实披露;复制样本 w=n/(2*n_class) 于训练集内,seed 固定)
固定五项输出(规格硬性): 类别分布 / accuracy(仅对照,受类别不平衡影响)/ 混淆矩阵 / ROC-AUC+95%CI (Hanley-McNeil 正态近似)/ 特征 OR 与 p 值(statsmodels Logit 矩阵接口, OR=exp(beta))。ConvergenceWarning(完美可分)-> convergence_warning 注明系数不稳定。
示例: logistic_regression("tests/fixtures/binary_noisy.csv", target="label", features=["score"]) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | ||
| features | No | ||
| file_path | No | ||
| test_size | No | ||
| inline_data | No | ||
| class_weight | No | balanced | |
| random_state | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and handles it well. It discloses deterministic duplication for class_weight='balanced', the absence of built-in statsmodels weights, fixed random seeds, stratified split behavior, convergence warnings on perfectly separable data, and the caveat that accuracy is affected by class imbalance.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but well-structured with clear sections for parameters, outputs, examples, and inline data. The maintenance note 'docstring = agent 使用说明书...' is meta and not directly actionable, but the remaining content is dense and relevant. It is appropriately sized for a 7-parameter tool with nontrivial behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers inputs, defaults, outputs, error behavior, class-weight implementation, and convergence warnings, which is strong given no output schema exists. It lists the five required outputs but does not specify their exact JSON structure or types, and some inline-data limits are deferred to an external SPEC document.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 for all 7 parameters. It does: file_path, target, features, test_size, random_state, class_weight, and inline_data are each explained with types, defaults, constraints, and special behaviors. This far exceeds the bare schema and gives an agent enough to construct valid calls.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies the tool as '建模组 · 逻辑回归' and details its binary classification role, target/feature requirements, and fixed outputs. It clearly distinguishes it from sibling modeling tools like linear_regression by focusing on binomial targets and OR/p-values, though it never states an explicit verb phrase like 'fits a logistic regression model'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives concrete usage constraints: target must be exactly 2 classes, features must be numeric, one-hot encoding is not performed, and non-numeric features raise errors. It also explains the inline_data vs file_path choice. It does not explicitly name alternative tools for other scenarios, but the binary-classification framing makes the intended use clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
missing_reportA
missing_report —— 数据探查组 · 缺失报告(工具 3,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/01_data_exploration_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径(拒绝 UNC)
返回: 成功 {"status":"ok","result":{...},"summary":"一句话中文结论"} 失败 {"status":"error","message":"中文原因"} result: {n_rows, n_columns, total_missing, overall_missing_rate, columns: {<列名>: {n_missing, missing_rate}}, complete_rows, rows_with_missing, patterns: [{columns, rows, note}]}
缺失定义: 空单元格与空串在读表层统一为 NaN(read_csv 默认),一律计入缺失; 全缺失列 rate=1.0 并注记;成对模式 = 两列同时缺失的行数(同源故障信号); patterns 最多 10 条,按缺失行数降序;无缺失时 patterns=[]。
示例: missing_report("samples/dirty.csv") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden and succeeds. It discloses the success/error envelope, defines missing as empty cells/strings converted to NaN, specifies all-missing columns rate=1.0 with a note, explains pairwise missing patterns, caps patterns at 10 sorted descending, and sets patterns=[] when no missing values exist.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but well-organized into parameters, return format, missing definitions, example, and inline-data notes. It loses a point for the meta-maintenance sentence ('docstring = agent 使用说明书...') which is not actionable for an agent, though the core content is front-loaded and non-redundant.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite lacking an output schema and annotations, the description is self-sufficient. It provides input modes, constraints, a full text-based result schema, error response shape, and edge-case rules, giving an agent everything needed to invoke the tool and interpret results.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 fully. It enriches file_path with supported formats (csv/tsv/xlsx/json) and the local-path-only constraint, and inline_data with two accepted shapes (records array or header/rows object) plus the mutual-exclusivity rule. This goes far beyond the bare type-only schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as a missing-value report ('缺失报告') and details the output structure with counts, rates, and patterns. It does not explicitly call out sibling alternatives, so it falls just short of full differentiation, but the purpose is unmistakable.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description offers parameter-level constraints such as '仅接受本地路径(拒绝 UNC)' and inline_data being mutually exclusive with file_path ('二选一'), but it never states when to choose this tool over sibling tools like impute_missing. No use-case scenarios or alternative recommendations are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
nonparametric_testA
nonparametric_test —— 统计推断组 · 非参数检验(工具 26,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/09_inference_batch3.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) test (str, "wilcoxon"): wilcoxon(配对)/ mann_whitney(两组独立)/ kruskal_wallis(多组) column (str): test=wilcoxon 时必填(配对的第一组测量) sample2_col (str): test=wilcoxon 时必填(配对第二组测量) group_col (str): test=mann_whitney / kruskal_wallis 时必填(分组列) value_col (str): test=mann_whitney / kruskal_wallis 时必填(数值列) alpha (float, 0.05): 显著性水平 ∈ (0,1) alternative (str, "two_sided"): two_sided / less / greater(仅 wilcoxon 与 mann_whitney 生效;kruskal_wallis 恒为双侧)
口径(设计文档 09 钉死): wilcoxon: scipy.stats.wilcoxon(zero_method="wilcox", correction=False, method="auto")——0 差剔除(zero_method=wilcox 语义);method="auto": 小样本无 ties 用精确分布,否则正态近似;效应量 matched rank-biserial r = 2×(正秩和)/n(n+1) − 1,等价式 1 − 4W/(n(n+1))(W=scipy 返回的较小秩和), 方向以 mean(column − sample2_col) 符号定(column 高为正侧),n=剔除 0 差后的对数。 mann_whitney: scipy.stats.mannwhitneyu(use_continuity=True, method="auto") ——注明 ties 时用正态近似含连续性校正;效应量 rank-biserial r = 2U/(n1·n2) − 1(U=scipy 对 group1 的统计量),方向 group1 高为正侧。 kruskal_wallis: scipy.stats.kruskal——统计量 H(未做 ties 校正,注明); 效应量 epsilon² = H/(N−1)(= (ΣᵢRᵢ²/nᵢ − 3(N+1))/(N−1),N 为总样本量), 近似解释为"组间秩差异占总秩变异的比例"。 结论固定模板:p<α 拒绝 H0 / p≥α 不能拒绝;局限声明(非参检验功效通常低于 参数检验、ties 处理、样本量)。
边界: 样本不足(wilcoxon 有效对数 n<5;mann_whitney 每组 n<2;kruskal 组数 2~20 且每组 n>=2)、差值无变异/常量组、alpha/alternative 非法、NaN/Inf 防御—— 一律中文报错;无图。
示例: nonparametric_test("samples/clean.csv", test="mann_whitney", group_col="category", value_col="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| test | No | wilcoxon | |
| alpha | No | ||
| column | No | ||
| file_path | No | ||
| group_col | No | ||
| value_col | No | ||
| alternative | No | two_sided | |
| inline_data | No | ||
| sample2_col | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full weight and delivers exact SciPy functions/methods, tie handling, zero-difference removal, continuity correction, effect-size formulas and direction conventions, fixed conclusion wording, sample-size boundaries, and Chinese error behavior. This goes far beyond what the input schema offers.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The text is long but organized into clear sections (parameters, statistical conventions, boundaries, example, inline data) with front-loaded parameter semantics. Minor internal metadata such as '工具 26' and doc-sync notes add noise but do not prevent quick scanning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex 9-parameter tool with no output schema, the description covers inputs, edge cases, and behavioral conventions thoroughly. The main gap is the absence of an explicit return-value contract (field names/shape), although the conclusion template and effect-size definitions partially compensate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and there are no required parameters, so the description is the only source of parameter meaning. It explains every parameter, defaults, allowed values, conditional requirements (e.g., column/sample2_col only for wilcoxon), alpha bounds, alternative applicability, and inline_data shape.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies the tool as nonparametric inference (统计推断组 · 非参数检验) and enumerates the three supported tests: Wilcoxon, Mann-Whitney, and Kruskal-Wallis. This makes the operation and resource clear, and the concrete test names distinguish it from sibling tools like anova_test or chi_square_test.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It maps each supported test to its data scenario (paired, two independent groups, multiple groups) and states conditional parameter requirements. It does not explicitly contrast the tool with sibling hypothesis tests or tell the agent when a parametric alternative would be preferred, though it notes nonparametric tests generally have lower power.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
normality_testA
normality_test —— 统计推断组 · 正态性检验(工具 9,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/03_inference_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) column (str): 分析列(须为数值列) method (str, "auto"): auto / shapiro / dagostino auto: n<=5000 -> Shapiro-Wilk(scipy 官方建议 3~5000);5000<n<=100000 -> D'Agostino-Pearson(scipy.stats.normaltest);n>100000 -> 中文报错提示抽样
输出: method_used, n, statistic, p_value, skew(Fisher 样本偏度,同 describe), kurtosis(超额峰度,正态=0), normal(判定 = p_value > 0.05), threshold_alpha(固定 0.05 并在输出注明)
边界: n<3 / 常数列(方差 0)/ 显式 shapiro 但 n>5000(scipy 限制)/ dagostino 且 n<8(scipy 要求)/ 非数值或缺失列 —— 全部中文报错。
示例: normality_test("samples/clean.csv", column="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| column | No | ||
| method | No | auto | |
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden and meets it: it enumerates exact method-switching thresholds, output keys, the fixed 0.05 alpha and normal decision rule, and all Chinese-error boundary cases. This goes well beyond the schema and gives the agent a precise model of tool behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well structured with labeled sections and front-loads the core purpose in the first line. It is longer than necessary because the maintenance/docstring note and the SPEC.md pointer are meta-information rather than invocation guidance, but the density of actionable detail justifies most of the length.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex inference tool with no output schema and no annotations, it covers parameters, outputs, errors, and an example. The main gap is that inline_data limits and typing are deferred to an external SPEC.md document rather than summarized inline, which leaves some behavior undocumented for an agent that cannot follow that reference.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description documents all four parameters: file_path formats, column numeric requirement, method enum values with auto logic, and inline_data's two accepted shapes plus its mutual exclusivity with file_path. It fully compensates for the empty schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as a normality test in the statistical inference group and specifies the resource being analyzed (a numeric column). It is distinguishable from siblings by its name and function, but it does not explicitly contrast itself with related tools like nonparametric_test or hypothesis_test, so it stops short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides detailed method-selection rules (auto -> Shapiro-Wilk for n<=5000, D'Agostino-Pearson for 5000<n<=100000, and an error for larger samples), boundary conditions, and a working example. However, there is no explicit statement of when to prefer normality_test over sibling tools such as nonparametric_test or describe_statistics, so the usage context is implied rather than directly stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
outlier_detectA
outlier_detect —— 数据探查组 · 异常值检测(工具 5,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/02_data_exploration_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json),仅接受本地路径 method (str, "iqr"): 仅支持 iqr(规格 4 唯一定义;zscore 场景在时序组 rolling_zscore)
口径: IQR 法:lower = Q1 - 1.5IQR,upper = Q3 + 1.5IQR(分位数 linear 插值,同 describe); 异常值 = 有效值中 <lower 或 >upper 的值;绝不自动剔除,只报告; 数值列有效值 n<4 → IQR 无定义,bounds=null、n_outliers=0;常量列 bounds 相等无异常; 非数值列跳过并列入 skipped_columns;单列异常值超 100 个时截断显示并注明。
图(附录 D): 并列箱线图(异常值红色 scatter);文件名 outlier_detect_all_YYYYmmdd_HHMMSS.png 存 reports/plots/;返回 JSON 顶层附加 image(绝对路径,禁 base64,与 result 平级)。
示例: outlier_detect("samples/dirty.csv") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | iqr | |
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and excels: it discloses that outliers are never deleted, details edge cases for n<4 and constant columns, explains that non-numeric columns are skipped, truncates display at 100 outliers, and describes the plot file path and top-level __image__ return field with no base64. This is far beyond typical behavioral disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with labeled sections for parameters, methodology, behavior, plot output, example, and inline data, and it front-loads the tool's purpose. It is somewhat verbose and includes maintenance metadata about docstring sync that is not directly needed for invocation, but the extra detail is organized and mostly earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given there is no output schema and no annotations, the description covers invocation parameters, algorithmic edge cases, output artifacts, and inline-data alternatives comprehensively. An agent has enough context to call the tool correctly, understand its edge-case behavior, and interpret the returned result including the __image__ field.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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, and it does thoroughly. file_path is documented with accepted formats and local-only restriction; method is constrained to iqr with default; inline_data is described with two supported shapes, mutual exclusivity with file_path, and a spec reference for limits. This fully supplies the meaning missing from the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as outlier detection ('异常值检测') and specifies the IQR algorithm with concrete lower/upper bound definitions. It distinguishes the method from z-score scenarios by pointing to rolling_zscore, but it does not explicitly differentiate this tool from the sibling anomaly_detect, so sibling differentiation is incomplete.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit when-not guidance: only iqr is supported, and z-score scenarios belong to rolling_zscore in the time-series group. It also states that outliers are never removed automatically, only reported. However, it does not give a clear explicit comparison with anomaly_detect or a general 'use this for tabular univariate outlier detection' rule, so guidance is strong but not fully comprehensive.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pca_analysisA
pca_analysis —— 建模组 · 主成分分析(工具 15,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/05_modeling.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) n_components (int): 主成分数,1 <= n <= min(样本数, 特征数)(超界中文报错)
口径: 仅数值列(自动排除列出);StandardScaler 标准化后 sklearn PCA(random_state=42, PCA 本身无随机性,仅为接口一致);输出方差解释率+累积; 载荷反标准化 = 成分向量 × 特征标准差(原单位近似权重,规格要求); 载荷图(方差解释条形 + 前两主成分载荷向量,image 顶层); 结论注明"主成分是特征的线性组合,不等于业务因子"。
示例: pca_analysis("samples/clean.csv", n_components=2) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| inline_data | No | ||
| n_components | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With zero annotations provided, the description carries the full disclosure burden and meets it thoroughly. It reveals data filtering (numeric columns auto-excluded), preprocessing (StandardScaler), the non-randomness caveat (random_state=42 is interface consistency only), the exact loading de-standardization formula (component vector × feature std dev), the plot placement (__image__ top level), error behavior (out-of-bounds n_components yields Chinese error), and the interpretive guardrail that principal components are not business factors. This is exemplary transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but earns its length: sections for parameters, methodology (口径), example, and inline data are clearly delineated and scannable. The purpose is front-loaded in the first line. Minor deductions for the meta sentence about docstring maintenance synced with design docs and the '工具 15' organizational label, which are contextually useful but not strictly behavioral information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 3-parameter tool with no output schema and no annotations, the description covers inputs, constraints, preprocessing, computation, outputs (variance rates, cumulative, loadings, plot), and caveats. It is slightly incomplete in not specifying the exact return structure (e.g., field names of the result object beyond the plot key), and it defers scale limits and type-domain details to SPEC.md section 12 rather than stating them inline. Still, an agent has nearly everything needed to call and interpret the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must fully compensate, and it does for all three parameters. file_path gains supported formats (csv/tsv/xlsx/json); n_components gains the bound 1 <= n <= min(samples, features) plus error behavior; inline_data gains the two accepted shapes (records array or {header, rows} object), the v1.2.0+ version gate, and exclusivity with file_path. Every parameter receives meaning far beyond the bare string/integer/array types in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with '主成分分析' (Principal Component Analysis) and then specifies the exact pipeline: numeric-only columns, StandardScaler standardization, sklearn PCA, variance-explained and cumulative outputs, de-standardized loadings, and a loading plot. This is a specific verb+resource with distinct methodology that clearly separates it from statistical-test siblings like t-test, anova_test, and cluster_analysis. The '建模组 · 核心实现' framing also situates it within the modeling workflow.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is implied rather than stated: the tool is for PCA in the modeling group, and a concrete example (pca_analysis("samples/clean.csv", n_components=2)) demonstrates invocation. The inline_data vs file_path mutual exclusivity is documented. However, no explicit when-to-use guidance or named alternatives among the 29 sibling statistical tools is provided; an agent must infer when PCA is preferred over correlation_matrix, cluster_analysis, or factor-oriented analyses.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_boxA
plot_box —— 可视化组 · 箱线图(工具 25,核心实现)。
单列箱线图:图上标五数概括(min/q1/中位/q3/max)与 IQR 异常数(同 outlier_detect 口径, 但仅单列、无异常点导出表——异常定位请用工具 5)。 inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| column | No | ||
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and discloses meaningful behavior: the plot includes five-number summary and IQR outlier count, uses the same criterion as outlier_detect, and supports two inline_data shapes. However, it does not describe the return value or error behavior, which is a notable gap given there is no output schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is organized into a purpose line, a core behavior paragraph, and an inline-data note. It front-loads the main function and avoids fluff, though the inline-data section is somewhat verbose with the external SPEC reference.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 3 optional parameters, no output schema, and no annotations. The description covers input modes and plot contents but omits the return format, error handling, and parameter-level details such as column's format. Reliance on an external SPEC for limits reduces self-contained completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 inline_data in detail (records array or header/rows object) and its exclusivity with file_path, but it does not explicitly define the column parameter or file_path format, leaving some parameter semantics to inference.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool plots a single-column box plot with five-number summary and IQR outlier count. It explicitly distinguishes itself from outlier_detect by noting the single-column scope and absence of an outlier export table, leaving no ambiguity about what it does.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit usage guidance: inline_data and file_path are mutually exclusive, and it directs agents to Tool 5 for outlier localization, naming the alternative and the condition. The single-column scope also implies when not to use this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_forecastA
plot_forecast —— 可视化组 · 时序折线图(工具 24,核心实现)。
原值折线 + 7 日移动平均线;仅作图不预测(预测见工具 17)。 五项统一前置由 _common._prepare_series 承载(插值/聚合/时区均报告)。 inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| date_col | No | ||
| file_path | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full transparency burden. It meaningfully discloses that the tool only plots rather than predicts, describes the five unified preprocessing steps via _common._prepare_series, mentions interpolation/aggregation/timezone reporting, and documents inline_data versioning and limits. It stops short of describing the actual return format or any side effects, but the core behavior is transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loads the key distinction (plotting vs forecasting) and the core output (raw line + 7-day MA). Some references like '工具 24' and '_common._prepare_series' are cryptic but not redundant; overall it earns its length without fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose, data source options, preprocessing behavior, and inline data formats, which is substantial for a plotting tool. Yet with no output schema or annotations, it does not explain what the tool returns (e.g., image path or rendered figure), what happens if neither file_path nor inline_data is provided, or how errors surface. These are meaningful gaps for an agent selecting and invoking the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 does add real semantics for inline_data: supported shapes (records array or header/rows object), mutual exclusivity with file_path, and a pointer to limits in SPEC.md. However, date_col, value_col, and file_path are left to inference from their names, and no required-combination guidance is given.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action and resource: plotting a time-series line chart with raw values plus a 7-day moving average. It also explicitly sharpens the boundary by saying '仅作图不预测' and referencing the forecasting tool, distinguishing it from time_series_forecast and sibling plot tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly tells agents not to use this tool for forecasting ('预测见工具 17') and clarifies that inline_data and file_path are mutually exclusive alternatives. However, it does not explicitly contrast this tool with other plot siblings like plot_scatter or plot_histogram, so usage guidance is strong but not comprehensive.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_heatmapA
plot_heatmap —— 可视化组 · 相关热力图(工具 23,核心实现)。
全部数值列两两 Pearson 相关热力图(格内标 r;常量列对应 r=null)。 矩阵用 pandas .corr()(与 correlation_matrix 的 scipy pearsonr 同公式), 本工具不做 p 值与校正(与工具 4 明确分工)。 inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and discloses useful behavioral details: it uses pandas .corr() with the same formula as correlation_matrix, returns null r for constant columns, omits p-values/corrections, and accepts inline_data in two shapes. It does not explicitly state the return format or whether the plot is returned as an image/path, so it stops short of a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded with the core purpose, followed by formula, limitations, and inline-data details in a readable layout. The 'tool 23, core implementation' phrasing is mildly redundant, but the overall structure earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no annotations and no output schema, the description covers core behavior and inline-data formats well, but it omits file_path semantics and the exact return/visualization contract. The external SPEC reference helps but pushes required details outside the description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 does explain inline_data thoroughly: mutually exclusive with file_path, supports records arrays or header/rows objects, and references SPEC section 12 for limits. However, it gives no semantic detail about file_path beyond its existence, and the limits are deferred to an external document rather than stated.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: plotting a pairwise Pearson correlation heatmap for all numeric columns, with r values in cells. It also distinguishes itself from correlation_matrix by noting the shared formula but explicitly no p-values or corrections, which disambiguates it from the main sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context for when it applies (numeric-column correlation heatmap) and explicitly states what it does not do: p-values and corrections, citing a division of labor with 'tool 4'. However, the reference to 'tool 4' is not resolved by name, and there is no explicit guidance for choosing this over other plotting siblings such as plot_scatter or plot_histogram.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_histogramA
plot_histogram —— 可视化组 · 直方图(工具 22,核心实现)。
单列分布直方图,图上标 n/mean/std;分箱 = min(40, max(8, ceil(sqrt(n))))。 inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| column | No | ||
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the transparency burden. It does well by disclosing the binning formula, the statistics drawn on the plot, the supported inline_data shapes, and a pointer to SPEC.md for limits and type domains. It does not describe what the tool returns or how the plot is delivered, which is a minor gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The core purpose is front-loaded, followed by the binning rule and input format details. Some clutter exists ('工具 22,核心实现'), but overall the description is compact and scannable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers core plotting behavior and inline data constraints, but it lacks return/output semantics and does not adequately explain file_path or column behavior. Since there is no output schema, some of this burden falls on the description, and it is only partially met.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate. It adds meaning for inline_data and file_path by stating they are mutually exclusive and by describing inline_data formats. However, 'column' is only implied by 'single-column' and its null/default behavior is not explained, leaving an important parameter underdocumented.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states this is a single-column distribution histogram and specifies what the plot displays (n/mean/std). Its identity as a histogram distinguishes it from siblings like plot_scatter, plot_heatmap, and plot_box, even without naming them explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied by '单列分布直方图' and the inline_data/file_path mutual-exclusivity note. However, there is no explicit guidance about when to choose this tool over plot_box, plot_scatter, or other visualizations, and no alternative tool is mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
plot_scatterA
plot_scatter —— 可视化组 · 散点图(工具 21,核心实现)。
生成 x-y 散点图,图上标注 Pearson r 与样本量;缺失按成对剔除并报数。 图协议走 _common.save_plot(附录 D);返回顶层 image 绝对路径。 inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| x_col | No | ||
| y_col | No | ||
| file_path | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure and does so thoroughly: pairwise missing deletion with reporting, Pearson r and n annotation, save_plot protocol, and an absolute __image__ return path. These details reveal actual side effects and data-handling behavior beyond the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loads the core purpose first, followed by protocol and inline-data details. The '工具 21,核心实现' header adds minor clutter, but the overall structure is scannable and free of empty phrasing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a plotting tool with no output schema and no annotations, the description covers plot contents, missing-data handling, save/return conventions, and inline-data constraints. It is slightly incomplete because it does not explicitly state that exactly one of file_path/inline_data must be set or clarify required column semantics.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 adds real semantics for inline_data (two accepted shapes, mutual exclusivity with file_path, limits in SPEC §12), but it leaves x_col, y_col, and file_path without explanatory detail beyond their names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource: '生成 x-y 散点图' and identifies the tool as the scatter plot in the visualization group. It also discloses key outputs (Pearson r and sample size), though it does not explicitly contrast with sibling plotting tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives useful selection context between file_path and inline_data ('二选一') and documents the inline_data shapes, but it does not say when to prefer this tool over alternatives such as plot_histogram or correlation_matrix. Usage is implied by the description rather than explicitly stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
power_analysisA
power_analysis —— 统计推断组 · 功效分析/样本量计算(工具 27,v1.1.0 新增)。
回答两类问题:「要检出效应量,需要多少样本」与「给定样本量能检出多大效应 / 实际功效多少」。 纯封闭公式计算(statsmodels.stats.power 精确非中心 t / 正态近似),零 LLM、确定性输出。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/10_power_analysis.md 同步维护。
参数: scenario (str): one_sample_t(单样本/配对 t,n=总样本)/ two_sample_t(独立两样本 t,n=每组样本量)/ two_proportions(两独立比例,n=每组样本量) effect_size (float|None): Cohen's d(仅 t 系场景);与 n 至少提供一个;必须 >0 的有限数 n (int|None): 样本量;与 effect_size 至少提供一个;必须是 >=2 的整数 p1 (float|None), p2 (float|None): 两个总体比例 ∈(0,1),仅 two_proportions 场景且须成对; 工具内部换算 Cohen's h = 2·arcsin√p₁ − 2·arcsin√p₂ 并随 result/summary 报告 alpha (float, 0.05): 显著性水平 ∈(0,1) power_target (float, 0.80): 目标功效(求 n 时使用)∈(0,1) alternative (str, "two_sided"): two_sided / less / greater
模式决策表(任务书钉死): 只给效应侧 → mode="solve_n"(求 n_required_exact 与 n_recommended=向上取整) 只给 n → mode="detect_effect"(可检出标准化效应) 都给 → mode="verify"(返回实际 power 验算结果) 都不给 → E1001 中文报错
返回: 成功 {"status":"ok","result":{...},"summary":"..."}; result 含 scenario/n_each/n_total 及各模式专属字段;两比例场景另报 cohens_h。 局限声明(固定附在 summary 末尾):功效计算依赖效应量假设,实际效应量未知时结论仅供参考。
示例: power_analysis("two_sample_t", effect_size=0.5) # 经典配置 → 64/组 power_analysis("one_sample_t", n=34) # 反查可检出的 d power_analysis("two_proportions", p1=0.50, p2=0.80, n=100) # verify 实际功效
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | ||
| p1 | No | ||
| p2 | No | ||
| alpha | No | ||
| scenario | Yes | ||
| alternative | No | two_sided | |
| effect_size | No | ||
| power_target | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations present, the description carries the full burden of behavioral disclosure, and it does so thoroughly. It states that computation is deterministic, uses exact noncentral t/normal approximations via statsmodels, defines all three modes, documents the E1001 error condition, and discloses the fixed limitation disclaimer appended to the summary.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is long but well organized and front-loaded with purpose and usage context. Most sentences add value; only minor maintenance metadata like tool version and docstring sync status could be trimmed without hurting an agent's ability to select and invoke the tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 8 parameters, no output schema, and no annotations, the description is exceptionally complete. It covers parameter constraints, mode selection, return structure, error behavior, and limitations, with examples that illustrate realistic calls.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Input schema coverage is 0%, so the description must fully explain the parameters, and it does. Every parameter is documented with types, defaults, constraints, per-scenario meaning, and the Cohen's h conversion for two-proportion scenarios, plus examples showing parameter combinations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool is for power analysis and sample size calculation, and it specifies the two exact questions it answers. It adds scenario details (one_sample_t, two_sample_t, two_proportions) and a mode decision table, so it is easy to distinguish from related statistical tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context for when to use the tool: whenever the user asks how many samples are needed or what effect/power is achievable with a given n. It also provides a precise mode decision table based on which parameters are supplied, though it does not explicitly name sibling tools that should be used instead.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
seasonal_decomposeA
seasonal_decompose —— 时序组 · 季节分解(工具 18,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) date_col / value_col (str): 日期列与数值列 period (int|None, None): 周期;默认 FFT 主频自动估计(_common._estimate_period) model (str, "auto"): additive / multiplicative / auto auto: 全正值 -> multiplicative,否则 additive(注明选择依据)
口径: statsmodels.seasonal_decompose(extrapolate_trend="freq"); multiplicative 要求全正值(显式指定且含非正值 -> 中文报错)。 输出分量统计 + 最后完整周期季节因子 + 4 子图(image 顶层)。
示例: seasonal_decompose("samples/timeseries.csv", date_col="date", value_col="value") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | auto | |
| period | No | ||
| date_col | No | ||
| file_path | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations to carry the safety/behavioral burden, the description provides rich behavioral disclosure: it names the exact underlying call including extrapolate_trend='freq', explains the auto model-selection rule, documents the all-positive requirement for multiplicative decomposition and the resulting Chinese error, and describes the output shape (component statistics, seasonal factors, four subplots). This exceeds what any structured annotation would typically provide.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-sectioned and front-loads purpose and parameters before behavior and example. It is longer than strictly necessary due to maintenance/version notes and an external-doc pointer, but those additions are minor and don't obscure the actionable content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no output schema, the description covers inputs, model selection, constraints, error behavior, and high-level return content (component statistics, seasonal factors, four plots). It is slightly incomplete in that it defers inline_data scale/type limits to an external spec and doesn't enumerate the exact output fields, but an agent has enough to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must supply parameter meaning, and it does so for all six parameters: file formats for file_path, roles of date_col/value_col, FFT-based period auto-estimation, the additive/multiplicative/auto choices, and the two supported inline_data shapes. It also adds a mutual-exclusion rule between file_path and inline_data that the schema does not express.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies a specific operation — seasonal decomposition of a time series — with a concrete implementation (statsmodels.seasonal_decompose) and a simplified-implementation qualifier. It does not explicitly contrast itself with sibling time-series tools such as trend_analysis or time_series_forecast, so it falls just short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The use case is implied through the tool name, '时序组 · 季节分解', the parameter list, and an example, but there is no explicit statement of when to choose this tool over alternatives or when not to use it. The model-selection notes ('auto: 全正值 -> multiplicative,否则 additive') provide parameter-level guidance but not tool-selection guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
time_series_forecastA
time_series_forecast —— 时序组 · 时间序列预测(工具 17,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) date_col / value_col (str): 日期列与数值列 horizon (int): 预测步数,1 <= horizon <= 样本量*50%(超限中文报错)
口径: auto_arima(pmdarima,stepwise=True, random_state=42, max_order=8)自动定阶; 季节可估判定(FFT 主频 period 且 n>=2*period)-> SARIMA 否则 ARIMA 并注明; 五项统一前置由 _common._prepare_series 完成(插值/聚合/时区等均入 metadata); 输出预测值 + 95% CI(predict(return_conf_int=True))+ 历史/预测图(image 顶层); 常数列退化为均值预测并注明。
示例: time_series_forecast("samples/timeseries.csv", date_col="date", value_col="value", horizon=14) inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| horizon | No | ||
| date_col | No | ||
| file_path | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden and does so thoroughly: it discloses auto_arima settings, the FFT-based seasonal detection rule leading to SARIMA/ARIMA, common preprocessing via _prepare_series, the constant-column mean fallback, and the output format including a top-level __image__ plot. This gives an agent a clear model of what the tool will do internally and return.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is organized into labeled sections (参数, 口径, 示例, inline 数据) and front-loads the core purpose, but it contains meta-commentary such as 'docstring = agent 使用说明书' and '工具 17,简化实现' that does not help an agent invoke the tool. The technical content is useful, yet the opening wastes a sentence on documentation maintenance rather than tool behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that there is no output schema, the description adequately communicates the return values (forecast + CI + chart) and key behavioral rules such as seasonal model selection and mean fallback. It does not specify the exact response JSON structure or edge-case error behavior for invalid files, but for a forecasting tool with documented parameters and an example, coverage is sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description compensates by explaining all five parameters: file_path with supported formats, date_col/value_col as date and value column names, horizon with its numeric bounds and error message, and inline_data with its two accepted shapes and exclusivity with file_path. It also includes a concrete example call.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as 时间序列预测 (time-series forecasting) and specifies the output as forecast values plus 95% CI and a historical/forecast chart, so the verb and resource are specific. However, it never explicitly distinguishes this tool from siblings like backtest_forecast or seasonal_decompose beyond the name and output description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides input constraints such as accepted file formats, horizon bounds, and the file_path/inline_data mutual exclusivity, which implies when the tool is applicable. It does not explicitly state when to use this tool versus alternatives such as backtest_forecast or trend_analysis, so guidance is implied rather than direct.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
trend_analysisA
trend_analysis —— 时序组 · 趋势分析(工具 19,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) date_col / value_col (str): 日期列与数值列 method (str, "mann_kendall"): mann_kendall / theil_sen
口径: Mann-Kendall:scipy.stats.kendalltau(y, 时间序号) 的 tau 与 p(MK 检验的 tau 统计量 + 正态近似双侧 p,scipy 官方实现,输出注明该口径); Theil-Sen 斜率:点对斜率中位数(n<=2000 全枚举;n>2000 固定 seed 抽样 50000 对并注明);两种方法都输出 tau/p/slope,method 决定 slope 的计算主口径 (theil_sen 时 slope 为点对中位数;mann_kendall 时 slope 同样用 Theil-Sen 斜率, tau 为主统计量)。 含季节成分时输出"趋势结论需谨慎"警示(设计文档:不校正)。
示例: trend_analysis("samples/timeseries.csv", date_col="date", value_col="value") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | mann_kendall | |
| date_col | No | ||
| file_path | No | ||
| value_col | No | ||
| inline_data | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden and compensates well: it discloses the exact statistical formulas (kendalltau, normal approximation p), the Theil-Sen pairwise slope median, sampling behavior for n>2000 with fixed seed, and the seasonality warning. It stops short of describing exact return structure or error handling, but the core behavioral traits are covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is clearly structured into sections (parameters, methodology, example, inline data) and front-loads the purpose. Some meta-commentary (docstring sync, tool number) is extraneous, but the density of useful information justifies the length.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no annotations, no output schema, and five undocumented parameters, the description covers inputs, methods, output values, and cautions. It references external docs for inline data limits, which is a minor completeness gap if those docs are not accessible to the agent, but overall it is sufficient for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description compensates thoroughly: it explains file_path supported formats, date_col/value_col roles, method options with defaults, and inline_data shapes plus exclusivity with file_path. It also clarifies the statistical meaning of method choices, adding value far beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as time-series trend analysis with specific statistical methods (Mann-Kendall and Theil-Sen) and output values (tau/p/slope). It differentiates from siblings by its focus on trend statistics rather than forecasting or decomposition, though it does not explicitly name alternative tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives implementation details for method selection and clarifies the mutually exclusive file_path vs inline_data inputs, but it does not explicitly state when to use trend_analysis over sibling tools like seasonal_decompose or time_series_forecast. The 'seasonal component caution' hint implies one alternative but does not name it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
30 tool updates
v1.2.0- First observed
analysis_plan - First observed
anomaly_detect - First observed
anova_test - First observed
backtest_forecast - First observed
chi_square_test - First observed
cluster_analysis - First observed
confidence_interval - First observed
correlation_matrix - First observed
data_type_check - First observed
describe_statistics - First observed
effect_size - First observed
feature_importance - First observed
hypothesis_test - First observed
impute_missing - First observed
linear_regression - First observed
logistic_regression - First observed
missing_report - First observed
nonparametric_test - First observed
normality_test - First observed
outlier_detect - First observed
pca_analysis - First observed
plot_box - First observed
plot_forecast - First observed
plot_heatmap - First observed
plot_histogram - First observed
plot_scatter - First observed
power_analysis - First observed
seasonal_decompose - First observed
time_series_forecast - First observed
trend_analysis
TDQS
Tools are organized into clear functional groups (exploration, inference, modeling, time series, visualization, orchestration) and descriptions explicitly cross-reference each other to resolve boundary cases (e.g., plot_heatmap defers p-values to correlation_matrix; outlier_detect points time-series cases to anomaly_detect). However, genuine overlap remains: four tools handle two-group comparison (hypothesis_test, anova_test, nonparametric_test, effect_size) and correlation_matrix vs plot_heatmap compute essentially the same matrix, so an agent could hesitate on selection.
All names are clean snake_case with recognizable domain nouns, and subfamilies are internally consistent (plot_*, *_test, *_analysis, *_detect). The main deviation is verb placement: some tools are verb-first (describe_statistics, impute_missing, backtest_forecast) while others are verb-last (outlier_detect, anomaly_detect, seasonal_decompose), but the pattern remains readable and predictable.
30 tools is a heavy surface, above the 16-25 band that already feels dense, and would strain an agent's selection space. However, the server's scope is genuinely broad—six distinct statistical domains—and each tool serves a specific analytical purpose, so the count is defensible even if it approaches the upper limit of what is reasonable for one MCP server.
Coverage is comprehensive for the stated purpose: exploration (describe/type/missing/correlation/outlier/impute), inference (parametric, nonparametric, chi-square, ANOVA, CI, effect size, power), modeling (linear/logistic regression, clustering, PCA, feature importance), time series (forecast/backtest/decompose/trend/anomaly), visualization, and an orchestration planner. Minor gaps: no stationarity test (e.g., ADF) for time series, no general-purpose bar or line chart for categorical data, and no way to apply a fitted model to new data.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
The statistical analyst in your AI chat — validated, citable, re-runnable analysis of your data.
Precision math engine for AI agents. 203 exact methods. Zero hallucination.
Transform your data analysis with our Data Compute & Stats Bot. Effortlessly calculate descriptive
Deterministic reasoning stack for AI agents: simulate, decide & compute, plus cross-domain tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides powerful data analysis capabilities for AI systems with functions for data import/export, SQL querying, statistical analysis, and data processing.11-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to perform statistical process control calculations using validated, deterministic tools such as control charts, capability analysis, and tolerance intervals.3MIT
- AlicenseNot gradedqualityBmaintenanceA statistical analysis MCP server offering 30 tools for descriptive statistics, hypothesis tests, regression, and time series, all returning Markdown reports with automatic interpretations to enable AI agents to perform comprehensive data analysis.MIT
- AlicenseAqualityAmaintenanceEnables AI agents to drive IBM SPSS Statistics for statistical analysis and publication-quality chart generation through natural language, returning structured results and ensuring safe execution.51MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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