Skip to main content
Glama

條件查詢與群體聚合(query)

data_query
Read-onlyIdempotent

對一個母體下條件篩出一組標的,並對整組計算聚合統計(count/coverage/min/max/mean/median/sum),如「費用率 0.4% 以下的被動 ETF,其費用率中位數」。where 語法為「欄位 運算子 值」以 and 連接(例 fee<=0.4 and type=passive)。回應必附母體大小 population 與欄位覆蓋率 coverage(有幾檔真的有這個欄位)。注意:績效欄位可用於 where 篩選與聚合統計,但不得作為排序鍵——排序即排名,本站不對個別商品做推薦。Filter a universe and aggregate over the matched set.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "universe": "<universe>"
    },
    "name": "data_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sortNo排序鍵,只接受中性鍵 code/name/holders(規模/受益人數),不接受績效欄位
limitNosample 回列數,預設 10、上限 20
whereNo條件式,如 fee<=0.4 and type=passive;省略=全母體
universeYes母體,如 etf.tw(見 data_catalog)
aggregateNo聚合,如 median:fee,count(逗號分隔、最多 4 個)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / sort / description
      Previous value: -"排序鍵,只接受中性鍵 code/name/holders(規模/人氣),不接受績效欄位"New value: +"排序鍵,只接受中性鍵 code/name/holders(規模/受益人數),不接受績效欄位"
  2. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnly/idempotent/non-destructive/openWorld=false, so the safety profile is covered. The description adds genuinely useful context not in annotations: the response always includes population size and field coverage, and performance fields are allowed in where/aggregate but barred as sort keys for editorial-policy reasons.

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?

Front-loaded with the purpose and a concrete example before the syntax and caveats, which is the right ordering. Slight redundancy: the where example and the sort-key restriction appear in both the description and the schema text, costing a bit of space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description usefully explains the guaranteed response fields (population, coverage), and it covers where syntax, aggregate vocabulary, and the sort limitation. A reader still has to infer what a 'sample' row looks like when limit>0 and how deep the aggregate list can go relative to the schema's cap of four.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

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

Schema description coverage is 100%, so all five parameters are already documented, and the description's where example ('fee<=0.4 and type=passive') is nearly verbatim what the schema provides. It adds modest meaning by listing valid aggregate functions and explaining the rationale behind the sort restriction, but mostly echoes structured data.

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?

States a specific operation on a specific resource: filter a universe by a condition and compute aggregates (count/coverage/min/max/mean/median/sum) over the matched set, reinforced by a concrete worked example ('被動 ETF 費用率中位數'). This is clearly distinguishable in kind from point/series siblings, though no sibling is named as an explicit alternative.

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?

Usage is implied through the worked example and the where-syntax explanation, and it points to data_catalog for valid universe values. However, it never says when to use this instead of data_point, data_series, or data_table, nor does it state exclusions beyond the sort-key prohibition.

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.

Resources