Skip to main content
Glama

stagenth · 数据工具箱

data_query

查询 / 过滤 / 分组聚合数据文件,返回**实际数据行(JSON)**供 AI 直接分析(1 credit/次)。

    支持 CSV/TSV/JSON/NDJSON/Parquet,两种用法:
      · 原始 SQL(表名固定 t):sql="SELECT 商品, sum(销量) s FROM t GROUP BY 商品 ORDER BY s DESC LIMIT 5"
      · 结构化(不用写 SQL):group_by=["地区"], measures=["销售额"], agg="sum", sort_by="销售额", descending=true, limit=10
    SQL 仅允许单条只读 SELECT/WITH,禁止读文件/建表/联网。结果硬上限 1000 行,超出置 truncated=True。失败自动退款。
    返回 {ok, format, mode, columns, total_rows, returned_rows, truncated, rows[]}。
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aggNo聚合方式 sum/avg/count/min/max/median(默认 sum;count=数每组行数、无需 measures)
fmtNo格式 csv/tsv/json/ndjson/parquet;缺省自动识别
sqlNo只读 SQL,表名固定为 t。例:SELECT 地区, sum(金额) AS 合计 FROM t GROUP BY 地区 ORDER BY 合计 DESC LIMIT 10。仅允许单条 SELECT/WITH,禁止读文件/建表/联网。给了 sql 就忽略下面的结构化参数。
limitNo最多返回多少行(取前 N / Top-N);硬上限 1000
columnsNo明细模式:只返回这些列;缺省返回全部列
file_idNo已上传的数据文件 ID(与 data_base64 二选一)
filtersNo行过滤条件(AND 组合),每项 {column, op, value}。op 可选:eq/ne/gt/ge/lt/le/contains/in/notnull/isnull。例:[{"column":"状态","op":"eq","value":"失败"},{"column":"金额","op":"ge","value":1000}]
sort_byNo按哪一列排序(可为分组后的 measure 或 count 列)
group_byNo分组维度列。给了就进聚合模式:按这些列分组,对 measures 求 agg
measuresNo聚合模式:要统计的数值列;缺省=所有非分组的数值列
descendingNo降序排序(取 Top-N 常用 true)
data_base64No数据文件内容 base64(与 file_id 二选一)

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries full burden and excels: it discloses cost (1 credit/次), SQL restrictions (no file reads, table creation, or networking), a 1000-row hard cap with truncated flag, auto-refund on failure, and the complete return object structure. This is comprehensive 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but well-organized, with clear sections, bolded return format, and operational details presented in a scannable bullet style. Every sentence earns its place given the 12-parameter complexity; no fluff or redundancy.

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 tool with 12 params, two usage modes, and no output schema, the description fully covers return shape, constraints, failure handling, truncation behavior, and mode selection. It is exceptionally complete for its complexity.

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?

Although schema coverage is 100%, the description adds crucial parameter interaction semantics: SQL mode ignores structured params, group_by triggers aggregation mode, measures default to non-grouped numeric columns, agg defaults to sum, and count doesn't require measures. This significantly enriches the schema's individual 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 states it queries/filters/group-aggregates data files and returns actual JSON data rows for analysis. The verb+resource+outcome are specific and distinct from sibling tools like data_clean, data_join, and data_profile, which handle different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides clear context for when to use: querying/filtering/aggregating data files, with two explicit usage modes (raw SQL vs structured parameters) and constraints (SQL read-only, table name fixed). However, it does not explicitly name alternative tools or state when NOT to use this tool, 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.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.2/5.0
Disambiguation4/5

Each tool targets a distinct data operation (clean, convert, inspect, join, profile, query). There is minor overlap between data_inspect and data_profile (both provide column types and null information), but descriptions and names make the intended use clear.

Naming Consistency5/5

All tool names follow a consistent 'data_' prefix plus a concise verb (clean, convert, inspect, join, profile, query). The pattern is uniform and predictable.

Tool Count5/5

Six tools is well-scoped for a data processing toolbox. Each tool covers a core data wrangling need, and the count is neither sparse nor overwhelming.

Completeness5/5

The toolset covers the main data lifecycle: cleaning, format conversion, structural inspection, profiling, joining, and querying. No obvious critical operations are missing for common data analysis workflows.

Resources