Skip to main content
Glama

anomaly_detect

Detect anomalies in time-series data using STL, IQR, or rolling z-score methods. Identifies outliers in date/value columns from CSV, TSV, XLSX, or JSON files.

Instructions

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 节。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNostl
date_colNo
file_pathNo
thresholdNo
value_colNo
inline_dataNo

Schema Changelog

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

  1. First observedv1.2.0

TDQS

A4/5.0
Behavior5/5

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.

Conciseness3/5

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.

Completeness3/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/good-boy4069/statlab-mcp'

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