Skip to main content
Glama
Bigred97

Australian Bureau of Statistics

top_n

Rank dataset measures by highest or lowest value for the most recent period, returning only the top or bottom N rows to avoid processing full time series.

Instructions

Return the N rows with the largest (or smallest) value of a measure.

Ranks across the most-recent available period only (uses lastNObservations=1 under the hood) so the result is a clean "top N entities at the latest period" view — not noisy historical highs.

This is the most common agent workflow: "show me the top 10 X by Y". Without this tool, an agent would call get_data, receive the full time series, and then sort/slice locally — wasting tokens and turns. top_n does the rank server-side and returns only the requested rows.

Examples: # 5 states with the highest current unemployment rate top_n("LF", "unemployment_rate", n=5)

# 10 GCCSAs with the largest populations
top_n("ABS_ANNUAL_ERP_ASGS2021", "estimated_resident_population",
      n=10, filters={"region_type": "gccsa"})

# 3 industries with the lowest wage growth
top_n("WPI", "wage_price_index", n=3, direction="bottom")

Returns: DataResponse with at most n records, sorted by measure value in the requested direction. Other fields (period, unit, attribution) match a regular get_data call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNoHow many top (or bottom) rows to return.
filtersNoOptional additional dimension filters, same shape as get_data. Do NOT include the 'measure' key here — that is supplied via the `measure` parameter.
measureYesPlain-English measure key to rank by — one of the curated measure values for this dataflow. Use the describe endpoint or describe tool to see available measures.
directionNo'top' returns the N rows with the LARGEST measure values (highest unemployment_rate, biggest population, etc.). 'bottom' returns the SMALLEST.top
dataset_idYesABS dataflow ID. Must be a curated dataflow with a 'measure' dimension. Use the list-curated endpoint or list tool to enumerate.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvNo
unitNo
queryNo
staleNo
periodNo
sourceNoAustralian Bureau of Statistics
abs_urlYesClick-through URL for this dataset's source page. abs-mcp legacy name — prefer source_url (canonical) for new code. Both fields are populated identically.
recordsNo
row_countNoNumber of observation rows in records.
dataset_idYes
source_urlYesCanonical click-through URL. Same value as abs_url; both populated for backward compat.
attributionNoData sourced from the Australian Bureau of Statistics and licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). https://www.abs.gov.au/about/copyright-and-creative-commons
dataset_nameYes
retrieved_atYes
stale_reasonNo
truncated_atNo
server_versionNo
Behavior5/5

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

No annotations are provided, so the description fully covers behavioral aspects: it uses lastNObservations=1, ranks only the most-recent period, performs server-side ranking, and returns a DataResponse. This provides complete transparency for an agent.

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-organized with sections for purpose, usage rationale, examples, and return format. Every sentence adds value, and it is appropriately concise without omitting necessary details.

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?

Given the presence of an output schema, the description adequately explains the return shape (DataResponse with at most n records, sorted) and mentions other fields. It covers all relevant aspects for a ranking tool.

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 100%, establishing a baseline of 3. The description enhances understanding with examples, clarifies the 'direction' parameter, and warns not to include 'measure' in filters, adding value beyond 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 defines the tool's function: returning top or bottom N rows by a measure. It distinguishes from siblings like get_data by highlighting server-side ranking and efficiency, and provides concrete examples.

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 explains when to use ('most common agent workflow') and contrasts with get_data to avoid wasteful local sorting. While it lacks explicit 'when not to use' statements, the context and alternatives are clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bigred97/abs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server