Skip to main content
Glama

filter_count

Count rows that meet your filter conditions directly on the server, returning only the count and a small sample. Answer 'how many' questions without moving large data into context.

Instructions

按条件统计行数 —— 只返回计数,不返回数据行。

用途:回答"有多少条满足 X"这类问题。计数在服务端完成, 绝不会把成千上万行搬进上下文。

参数:

  • filters:条件列表,每项 {"column": "部门", "op": "==", "value": "研发"} 支持运算符:== != > < >= <= in not_in contains startswith endswith is_null not_null

  • sample:附带返回的样例行数(默认 3,仅用于确认过滤是否符合预期)

返回:matched_rows、matched_pct、少量样例,以及等价的 Excel COUNTIFS 公式 (可粘回表格动态更新)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sheetNo
sampleNo
filtersNo
file_pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description fully carries the behavioral burden. It discloses that the tool returns only a count, samples a small number of rows by default, reports matched_pct, and returns an Excel COUNTIFS formula. It also clarifies the sample's purpose is only to confirm filtering, which is helpful behavioral context beyond the schema.

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 well-structured and front-loaded: the core behavior appears first, followed by concise 用途/参数/返回 sections. Every sentence adds useful information without repetition or filler.

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?

Even without an output schema, it describes the return fields (matched_rows, matched_pct, samples, Excel formula) and explains the sample's confirmatory role. Minor gaps remain: no explicit guidance on file_path/sheet and no named alternative tools, but overall it is sufficiently complete for correct invocation.

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

Parameters4/5

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

Schema coverage is 0%, so the description must compensate. It adds strong semantics for filters, including the exact per-item object shape and the full list of supported operators, and explains the sample parameter's default and purpose. However, it does not document file_path or sheet, including that file_path is required, which leaves some parameters to be inferred.

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 gives a specific verb and resource: '按条件统计行数' (count rows by conditions), and explicitly scopes the tool to returning a count, not data rows. This clearly distinguishes it from siblings like read_range and top_n, which return row-level data or ranked rows.

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 states when to use the tool: to answer 'how many rows satisfy X' questions, and adds context that counting is done server-side so thousands of rows never enter the context. It does not explicitly name alternatives or give when-not-to-use exclusions, so it stops 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.