Skip to main content
Glama

top_n

Sort Excel rows by a column and return only the top N results for leaderboard queries like 'top 10 products'. Supports filters, column selection, ascending order, and returns Excel RANK formula.

Instructions

取排序后的前 N 行(默认降序),只回传这 N 行。

用途:排行榜类问题("销售额前 10 的产品")。 排序在服务端完成,只把 TopN 行回传,而不是把全表交给模型排序。

参数:

  • sort_by:排序列

  • n:返回行数(默认 10)

  • ascending:True 为升序(取最小的),默认 False 降序

  • columns:只返回这些列(省 token),省略返回全部列

  • filters:过滤条件(格式同 filter_count)

返回:带 rank 的行列表、tsv、以及等价的 Excel RANK 公式。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNo
sheetNo
columnsNo
filtersNo
sort_byYes
ascendingNo
file_pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral disclosure burden. It explains that sorting happens server-side, that only N rows are returned rather than the full table, and that the output includes ranked rows, TSV, and an Excel RANK formula. It does not explicitly state read-only behavior, but the wording strongly implies a non-mutating query.

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 compact and well-structured: core behavior first, then use case, then parameter details. Every sentence adds value, and the formatting makes it easy to scan.

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?

For a tool with no output schema and 7 parameters, the description covers the main behavior, use case, parameter semantics, and return format. It relies on a reference to filter_count for filter syntax, which is acceptable given the sibling relationship, and does not mention edge cases like n exceeding row count, but overall it is sufficiently complete.

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. It explains sort_by, n, ascending, columns, and filters, including defaults and the purpose of columns for token savings. The only unmentioned parameters are file_path and sheet, which are self-evident from the schema.

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 the tool's function: take sorted rows and return only the top N, with a specific default ordering. It also distinguishes itself from a full-table read by emphasizing that sorting is done server-side and only the TopN rows are returned, not the whole table.

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 explicitly identifies the intended use case: ranking/leaderboard questions such as 'top 10 products by sales'. It does not explicitly name alternative tools or state when not to use it, but the use-case framing gives clear contextual guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.