Skip to main content
Glama

outlier_detect

Detect outliers in tabular data via the IQR method. Returns lower/upper bounds and flagged outlier values for numeric columns, skipping non-numeric columns without removing anything.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoiqr
file_pathNo
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/5.0
Behavior5/5

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.

Conciseness4/5

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.

Completeness5/5

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.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, 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.

Purpose4/5

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.

Usage Guidelines4/5

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.

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