Skip to main content
Glama
Bigred97

Australian Institute of Health and Welfare

top_n

Return the highest or lowest N rows from an AIHW dataset ranked by a chosen measure, with optional filters to narrow the results.

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
nNoHow many top (or bottom) rows to return.
filtersNoOptional dimension filters, same shape as get_data.
measureYesPlain-English measure key to rank by. Use the describe endpoint or describe tool to see available measures.
directionNo'top' returns the N rows with the LARGEST measure values (highest deaths, biggest expenditure, etc.). 'bottom' returns the SMALLEST.top
dataset_idYesCurated dataset ID. Use the search or list-curated endpoint/tool to discover.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvNo
unitNo
queryNo
staleNo
periodNo
sourceNoAustralian Institute of Health and Welfare
recordsNo
aihw_urlYesClick-through URL for this dataset's source page. aihw-mcp legacy name — prefer source_url (canonical) for new code. Both fields are populated identically.
row_countNo
dataset_idYes
source_urlYesCanonical click-through URL. Same value as aihw_url; both populated for backward compat.
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/
dataset_nameYes
retrieved_atYes
stale_reasonNo
truncated_atNo
server_versionNo
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It explains that the tool performs server-side ranking, returns at most n records sorted by measure, and that other fields match get_data. The read-only nature is implied. It could be more explicit about idempotency or side effects, but overall the behavioral traits are adequately disclosed.

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 highly concise: a single sentence defining the tool, a paragraph explaining its value, three clear examples, and a returns summary. Every sentence serves a purpose, and the structure is front-loaded with the most critical information. No redundancy.

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 complexity (5 parameters, no annotations, sibling tools present), the description is complete. The output schema is available (as per context), so detailed return value explanation is unnecessary. The description covers purpose, usage, examples, and behavioral traits sufficiently.

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?

The input schema has 100% description coverage, so the baseline is 3. The description adds value by providing examples and usage guidance for each parameter, such as suggesting the describe tool for measure discovery and clarifying direction. This goes beyond the schema's basic descriptions, earning a 4.

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 function: 'Return the N rows with the largest (or smallest) value of a measure.' It uses a specific verb (return) and resource (rows), and distinguishes itself from sibling tools like get_data by explaining that it avoids retrieving full tables. The purpose is unambiguous and well-defined.

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?

The description explicitly identifies the primary use case: 'show me the top 10 X by Y' and contrasts with get_data to highlight efficiency. It provides multiple examples illustrating typical usage. While it doesn't explicitly state when not to use, the context is clear. A slight enhancement could be mentioning to use describe_dataset for measure discovery, but the parameter description already hints at that.

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