Skip to main content
Glama
Bigred97

Australian Institute of Health and Welfare

top_n

Retrieves the top or bottom N rows ranked by a measure, performing the sort server-side to reduce data transfer and token usage.

Instructions

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

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 table, and then sort/slice locally — wasting tokens and turns. top_n does the rank server-side and returns only the requested rows.

Examples: # Top 10 causes of death in 2023 (Persons) top_n("GRIM_DEATHS", "deaths", n=10, filters={"sex": "Persons", "year": "2023"})

# 20 SA3 regions with the highest age-standardised mortality
top_n("MORT_GEOGRAPHY", "age_standardised_rate_per_100000",
      filters={"category": "Statistical Area Level 3 (SA3)",
               "sex": "Persons", "YEAR": "2023"}, n=20)

# 5 lowest-funded health expenditure areas in NSW
top_n("HEALTH_EXPENDITURE", "real_expenditure_millions",
      filters={"state": "NSW", "financial_year": "2022-23"},
      n=5, 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
dataset_idYesCurated dataset ID. Use search_datasets() / list_curated().
measureYesPlain-English measure key to rank by. Use describe_dataset() to see available measures.
nNoHow many top (or bottom) rows to return.
filtersNoOptional dimension filters, same shape as get_data.
directionNo'top' returns the N rows with the LARGEST measure values (highest deaths, biggest expenditure, etc.). 'bottom' returns the SMALLEST.top

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYes
dataset_nameYes
queryNo
periodNo
unitNo
row_countNo
recordsNo
csvNo
sourceNoAustralian Institute of Health and Welfare
attributionNoData sourced from the Australian Institute of Health and Welfare (AIHW) via data.gov.au. Licensed under Creative Commons Attribution 3.0 Australia (CC BY 3.0 AU). https://creativecommons.org/licenses/by/3.0/au/
retrieved_atYes
aihw_urlYes
server_versionNo
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses that ranking is server-side, returns at most n sorted records, and that other fields match get_data. Lacks details on error handling or default sorting order, but overall transparent.

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?

Description is well-structured with a high-level summary, why-this-tool rationale, multiple examples, and return description. No superfluous content; every sentence earns its place.

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 tool's simplicity and the presence of an output schema (implied), the description fully covers the tool's behavior, including its role in agent workflows. It is complete enough for effective use.

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?

Input schema has 100% coverage. Description adds value by providing examples that clarify usage patterns and the relationship between parameters, exceeding the baseline of 3.

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?

Description clearly states the tool returns the N rows with the largest/smallest value of a measure. It distinguishes itself from sibling tools like get_data by emphasizing server-side ranking avoids full table retrieval.

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?

Explicitly frames the primary use case ('show me the top 10 X by Y') and contrasts with the alternative of calling get_data and sorting locally. Does not explicitly state when NOT to use, but the context is 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/aihw-mcp'

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