Skip to main content
Glama

data_type_check

Inspects each column in a dataset to detect data types (numeric, integer, date, category, text, mixed, missing) and reports validity, missingness, and dirty values, revealing data quality issues.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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 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.

Conciseness4/5

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.

Completeness5/5

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.

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 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.

Purpose5/5

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.

Usage Guidelines3/5

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.

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