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 公式。
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": {
"file_path": "<file_path>",
"sort_by": "<sort_by>"
},
"name": "top_n"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | ||
| sheet | No | ||
| columns | No | ||
| filters | No | ||
| sort_by | Yes | ||
| ascending | No | ||
| file_path | Yes |